Thursday, October 30, 2008 5:01 PM
by
admin
C# 4.0 Tuple
Finally there is a way on how to use tuple as it ought to be.
In C# 4.0, you can do the following
dynamic GetTuple()
{
return new { FirstName : “John”, LastName : “Adams” };
}
dynamic myTuple = GetTuple();
Console.WriteLine (myTuple.FirstName); //Look at this beauty
Update:
Remember that anonymous type is an immutable type. Once you set the value at creation, they cannot be changed.