0
我想要做这样的事情:VB.net LINQ表达式到列表(中GUID)
Dim selectedCourses As List(Of Guid) = From item In chkListCourses.Items Where item.Selected = True Select item.Value
,但我得到的错误:
Unable to cast object of type 'WhereSelectEnumerableIterator
2[System.Object,System.Object]' to type 'System.Collections.Generic.List
1[System.Guid]'.
项的值是一个Guid的字符串表示。
我还想要一个Lambda表达式的语法。
我会在新的GUID(item.Value) 错误重载决策失败,因为没有可访问的“新”可以不被称为错误缩小转换: '公共子新(g as字符串)':匹配参数'g'的参数从'Object'缩小为'String'。 'Public Sub New(b()As Byte)':参数匹配参数'b'从'Object'缩小到'Byte'一维数组'。 – 2009-12-17 04:21:52
对不起:D我认为这是C#。将其更改为: Dim selectedCourses As List(Of Guid)=(从chkListCourses.Items中的项目where item.Selected = True选择Id = New Guid(item.Value))。ToList(Guid) – 2009-12-17 06:59:11
我得到相同的新Guid错误(item.Value) – 2009-12-17 13:10:50