Showing posts with label Anonymous Types. Show all posts
Showing posts with label Anonymous Types. Show all posts

Anonymous Types

Friday, October 23, 2009

Anonymous Types (C# Programming Guide)
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to first explicitly define a type. The type name is generated by the compiler and is not available at the source code level. The type of the properties is inferred by the compiler. The following example shows an anonymous type being initialized with two properties called Amount and Message.
var v = new { Amount = 108, Message = "Hello" };
Anonymous types are typically used in the select clause of a query expression to return a subset of the properties from each object in the source sequenceAnonymous types are created by using the new operator with an object initializer.
Anonymous types are class types that consist of one or more public read-only properties. No other kinds of class members such as methods or events are allowed. An anonymous type cannot be cast to any interface or type except for object.

About LinQ

Thursday, July 30, 2009

What is Linq

• LinQ is Language Integrated Query.

• Unified approach for querying different databases, XML files and Text files.

• Unifying the tools across layers-

C# for Presentation Transformations

- C# for Business Objects-

C# for Data Queries

Language Enhancement in C#

• Query Syntax

• Typed local variables and arrays

• Anonymous Types

• Automatic Properties

• Object Initializers

• Extension Methods

• Lambda Expression

 
 
 
Your Ad Here