devxlogo

June 2, 2009

Create a Generic List at Run Time

You can create a list of a specific type at run time by passing the type to the MakeGenericType method, for example: Type t = Type.GetType(“System.Int32”);IList tList= (IList)Activator.CreateInstance( (typeof(List&lt&gt).MakeGenericType(t))); tList.GetType().FullName

Bricks and Mortar: Building a Castle

n an application built with object-oriented techniques, objects are the bricks. You construct little pieces of code encapsulated in these bricks. To build bigger structures, you need to hold these