Generics and anonymous type

Posted by nettguy on Stack Overflow See other posts from Stack Overflow or by nettguy
Published on 2010-04-01T15:19:00Z Indexed on 2010/04/01 15:23 UTC
Read the original article Hit count: 212

Filed under:
|

I understood,normally generics is for compile time safe and allow us to keep strongly typed collection.Then how do generic allow us to store anonymous types like

List<object> TestList = new List<object>();
TestList.Add(new { id = 7, Name = "JonSkeet" });
TestList.Add(new { id = 11, Name = "Marc Gravell" });
TestList.Add(new { id = 31, Name = "Jason" });

© Stack Overflow or respective owner

Related posts about c#

Related posts about generics