/ Published in: C#

Notice that the property name declared (foo) is used later in the query for the ORDERBY operator and SELECT statement.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
{ var contacts = from c in context.Contacts where c.FirstName == "Robert" let foo = new { c.Addresses } orderby foo.ContactName.LastName select foo; foreach (var contact in contacts) { var name = contact.ContactName; Console.WriteLine("{0} {1} {2}: # Addresses {3}", name.Title.Trim(), name.FirstName.Trim(), name.LastName.Trim(), contact.Addresses.Count()); } }
Comments
