LINQ in Action roller

Fun with Anonymous Types and LINQ to XML

You can, of course, use C# anonymous types to create types that are more than simple tuples. For example, you can nest anonymous types to create an object graph: var PurchaseOrder = new { PurchaseOrderNumber = "99503", OrderDate = DateTime.Parse("1999-10-20"), Addresses = new [] { new { AddressType = "Shipping", Name = "Alice Smith", Street = "123 Maple Street", City = "Mill Valley", State = "CA", Zip = "90952", Country = "USA" }, new { AddressType = "Billing", Name = "Robert Smith", Street = "8 Read More...
Published Saturday, September 16, 2006 11:13 AM by Eric White's Blog
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication