Sunday, 15 September 2013

Anonymous Types in C#

Anonymous Types in C#

// x is compiled as an int
var x = 10;
// y is compiled as a string
var y = "Hello";
// z is compiled as int[]
var z = new[] { 0, 1, 2 };
but
// ano is compiled as an anonymous type
var ano = new { x1 = 10, y1 = "Hello" };
ano object's properties created are read-only . I want to figure it out
why those properties are read only. suggestions appreciated ?

No comments:

Post a Comment