Tuesday 18 December 2012

VB.NET - linq where in clause example


                Dim groupsToFind = New List(Of Integer)() From {4, 15, 19, 26, 1, 10, 6, 9, 8, 7, 11, 13, 17, 18, 2, 3, 5, 20, 38, 49}
                Dim plain = dsInventory.Tables("Plain").AsEnumerable()
                Dim plains = From h In plain _
                                Group h By GroupName = h.Field(Of String)("Group"), GroupId = h.Field(Of Int32)("group_id") _
                                    Into Group _
                                    Where groupsToFind.Contains(GroupId)
                                    Order By GroupName _
                                    Select GroupName

No comments:

Post a Comment