Go to home page mail me! RSS Feed

April 2009 Entries

Get a new instance of a generic object

/// <summary> /// using reflection to create an instance of a generic type /// </summary> /// <returns>T as the generic type</returns> private static T GetNewObject() { try { return (T)typeof(T).GetConstructor(new Type[] { }).Invoke(new object[] { }); } catch...

posted @ Friday, April 17, 2009 5:24 PM | Feedback (0)

Next entries »