我做了一个C#到VB.net转换,除了1件事以外都经历了。
获得错误"期望结束语"
代码
Dim query = From line In allLines Let data = line.Split(","C)New With { _
Key .number = data(0), _
Key .ip = data(1) _
}
我不确定它不喜欢上面的代码。
原始C#代码
var query = from line in allLines
let data = line.Split(',')
select new
{
number = data[0],
ip = data[1],
};
答案 0 :(得分:2)
您的VB代码缺少关键字Select
。等效的C#代码应为
Dim query = From line In allLines
Let data = line.Split(","c)
Select New With {Key .number = data(0), Key .ip = data(1)}