SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 61 | Next

Scott Klein

"Professional LINQ"


You can also rename a field in the sequence when using anonymous types. Here??™s how:
var query =
from c in contact
select new { c.FirstName, c.LastName, Email = c.EmailAddress} ;
24
Chapter 2: A Look at Visual Studio 2008
foreach (var item in query)
listBox1.Items.Add(item.FirstName + " " + item.LastName + " " +
item.Email);
Chapter 3 discusses this in more detail.
Visual Basic
Object initializers in Visual Basic work the same way as C# initializers. They provide the ability to
specify properties for a complex object by using a single expression, and create instances of named
and anonymous types.
The following shows the previous anonymous type example in Visual Basic .NET syntax:
_
Public Class Contact
_
Public Title As String
_
Public FirstName As String
_
Public MiddleName As String
_
Public LastName As String
_
Public EmailAddress As String
End Class
Private Sub Button2_Click(ByVal sender As System.


Pages:
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6