196Microsoft Visual Studio 2010: A Beginner’s Guide

Console.ReadKey();

}

}

VB:

Class Customer

Property FirstName As String

Property LastName As String

End Class

Module Module1

Sub Main()

Dim custList As New List(Of Customer) From

{

New Customer With

{

.FirstName = "Joe",

.LastName = "Zev"

},

New Customer With

{

.FirstName = "May",

.LastName = "Lee"

},

New Customer With

{

.FirstName = "Meg",

.LastName = "Han"

}

}

Dim customers =

From cust In custList

Where cust.FirstName.StartsWith("M") Select cust

For Each cust In customers

Console.WriteLine(cust.FirstName)

Next

Console.ReadKey()

End Sub

End Module

Page 219
Image 219
Microsoft 9GD00001 manual Microsoft Visual Studio 2010 a Beginner’s Guide