Cool, another thing in .NET allows anonymous. It's quite handy to have anonymous method and type support.
var meeting = new {Time = 3.Hours().Ago(), Location = "Ellerslie"}; |
The variable meeting has a type, which, technically not really anonymous. An ugly system name is assigned to this type and which I honestly cannot remember.
If there is another anonymous type with the same initializer, C# 3.0 is smart enough to recognise them as the same type. e.g.
var meeting2 = new {Time = 3.Hours().FromNow(), Location = "CBD"}; meeting = meeting2; |
I think this is really cool although I don't have in mind where can I use this yet, haha.
No comments:
Post a Comment