Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.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
Vb.net 无法强制转换类型为';图像滞后';输入';System.Collections.Generic.IEnumerable`1[ImagesFlag]';_Vb.net_Linq_Casting_Concatenation - Fatal编程技术网

Vb.net 无法强制转换类型为';图像滞后';输入';System.Collections.Generic.IEnumerable`1[ImagesFlag]';

Vb.net 无法强制转换类型为';图像滞后';输入';System.Collections.Generic.IEnumerable`1[ImagesFlag]';,vb.net,linq,casting,concatenation,Vb.net,Linq,Casting,Concatenation,下面是产生错误的代码 Private Function GetFlag(ByVal ImagesFlagList As IQueryable(Of ImagesFlag)) As String ImagesFlagList = ImagesFlagList.AsEnumerable().Concat(New ImagesFlag With _ {.Flag = "test"}).AsQueryable() Return "something" End Function 我怎样才能投下这个

下面是产生错误的代码

Private Function GetFlag(ByVal ImagesFlagList As IQueryable(Of ImagesFlag)) As String
 ImagesFlagList = ImagesFlagList.AsEnumerable().Concat(New ImagesFlag With _
 {.Flag = "test"}).AsQueryable()
 Return "something"
End Function
我怎样才能投下这个? 谢谢

问题就在这里

.Concat(New ImagesFlag With {.Flag = "test"})
Concat
需要一个序列,一个
IEnumerable
,您只需传递一个
ImagesFlag
。您将需要传递一系列标志,它可以是该项的数组

Dim array as ImagesFlag() = { new ImagesFlag With { .Flag = "test" } }
然后可以在调用Concat时使用数组

.Concat(array)
问题就在这里

.Concat(New ImagesFlag With {.Flag = "test"})
Concat
需要一个序列,一个
IEnumerable
,您只需传递一个
ImagesFlag
。您将需要传递一系列标志,它可以是该项的数组

Dim array as ImagesFlag() = { new ImagesFlag With { .Flag = "test" } }
然后可以在调用Concat时使用数组

.Concat(array)