Tutorial by Examples

' sample data Dim sample = {1, 2, 3, 4, 5} ' using "query syntax" Dim squares = From number In sample Select number * number ' same thing using "method syntax" Dim squares = sample.Select (Function (number) number * number) We can project multiple result at once too ...
Dim sites() As String = {"Stack Overflow", "Super User", "Ask Ubuntu", "Hardware Recommendations"} Dim query = From x In sites Where x.StartsWith("S") ' result = "Stack Overflow", "Super User" Query will be enumerable objec...
Dim sites() As String = {"Stack Overflow", "Super User", "Ask Ubuntu", "Hardware Recommendations"} Dim query = From x In sites Select x.Length ' result = 14, 10, 10, 24 Query...
Dim sites() As String = {"Stack Overflow", "Super User", "Ask Ubuntu", "Hardware Recommendations"} Dim query = From x In sites Order By x.Length ' result = &qu...
' Just setting up the example Public Class A Public Property ID as integer Public Property Name as string Public Property OtherValue as Object End Class Public Sub Example() 'Setup the list of items Dim originalList As New List(Of A) originalList.Add(New A() With {...
Dim duplicateFruits = New List(Of String) From {"Grape", "Apple", "Grape", "Apple", "Grape"} 'At this point, duplicateFruits.Length = 5 Dim uniqueFruits = duplicateFruits.Distinct(); 'Now, uniqueFruits.Count() = 2 'If iterated over at this poin...

Page 1 of 1