Dim list As New Dictionary(Of Integer, String) From {{1, “Bart”}, {2, “Lisa”}, {3, “Homer”}} Array Literals: Dim a = {1, 2, 3} 'infers Integer() Dim b = {1, 2, 3.5} 'infers Double()
Console.WriteLine(n)) Array.ForEach(items, Sub(n) If n Mod 2 = 0 Then Console.WriteLine(n) End Sub) 'Count the number of even items in the array Dim total = items.Count(Function(n)
(Apple inherits from Fruit) Dim fruits As IEnumerable(Of Fruit) = apples 'Contravariance - Func(Of In T, Out R) Dim predicate As Func(Of Fruit, Boolean) = Function(f) f.Color = "Red" apples.Where(predicate)