Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将C代码转换为VB.Net:无法使用这些参数调用可访问的“Select”_C#_Vb.net_Linq - Fatal编程技术网

C# 将C代码转换为VB.Net:无法使用这些参数调用可访问的“Select”

C# 将C代码转换为VB.Net:无法使用这些参数调用可访问的“Select”,c#,vb.net,linq,C#,Vb.net,Linq,我试图将C代码转换为VB语言,但出现以下错误: 错误231重载解析失败,因为没有可访问的“选择” 可以使用以下参数调用: 扩展方法的公共函数SelectOf TResult SELECTOR为System.FuncOf System.Data.IDataRecord,Integer,TResult为 中定义的System.Collections.Generic.IEnumerableOf TResult “System.Linq.Enumerable”:嵌套函数没有签名 与委托的System.F

我试图将C代码转换为VB语言,但出现以下错误:

错误231重载解析失败,因为没有可访问的“选择” 可以使用以下参数调用: 扩展方法的公共函数SelectOf TResult SELECTOR为System.FuncOf System.Data.IDataRecord,Integer,TResult为 中定义的System.Collections.Generic.IEnumerableOf TResult “System.Linq.Enumerable”:嵌套函数没有签名 与委托的System.FuncOf兼容的 System.Data.IDataRecord,整数,TResult'。 扩展方法的公共函数SelectOf TResult SELECTOR为System.FuncOf System.Data.IDataRecord,Integer,TResult为 中定义的System.Collections.Generic.IEnumerableOf TResult “System.Linq.Enumerable”:类型参数的数据类型不能 从这些论点中可以推断出。指定数据类型 可能会显式更正此错误。 扩展方法的公共函数SelectOf TResult SELECTOR为System.FuncOf System.Data.IDataRecord,TResult为 中定义的System.Collections.Generic.IEnumerableOf TResult “System.Linq.Enumerable”:类型参数的数据类型不能 从这些论点中可以推断出。指定数据类型 可能会显式更正此错误。C:\Users\Admin\Documents\Visual 演播室 2010\Projects\SalesRepProject\SalesRep\Code\Job\JobInfoRepository.vb 25 13 SalesRep

下面是C的代码:

 using (var reader = command.ExecuteReader())
       return reader.Cast<IDataRecord>()
           .Select(x => new JobInfo(){ 
               JobID = x.GetInt32(0), 
               Name = x.GetString(1), 
               LastExecutionDate = x.GetDateTime(2),  
               Status  = x.GetString(3) 
           }).ToList();
有什么想法吗。提前谢谢你

我不知道那些关键的声明是为了什么。我认为这应该做到:

Using reader = command.ExecuteReader()
       Return reader.Cast(Of IDataRecord)().Select(Function(x) 
           New JobInfo() With {
               .JobID = x.GetInt32(0), 
               .Name = x.GetString(1), 
               .LastExecutionDate = x.GetDateTime(2), 
               .Status = x.GetString(3)
           }).ToList()
End Using

只需删除selectit在下一个括号中给我的错误:预期标识符。你是说完整的selectit在线转换器不区分本例中的集合初始值设定项和适用于“Key”关键字的匿名类型。
Using reader = command.ExecuteReader()
       Return reader.Cast(Of IDataRecord)().Select(Function(x) 
           New JobInfo() With {
               .JobID = x.GetInt32(0), 
               .Name = x.GetString(1), 
               .LastExecutionDate = x.GetDateTime(2), 
               .Status = x.GetString(3)
           }).ToList()
End Using