Here is the sample code I figure out, using System; namespace X var GenericType = Type.GetType("X." + byString); var genericMethod = typeof(Program).GetMethod("GetList") var output = genericMethod.Invoke(null, new object[] { GenericIns }); public static T GetList<T>(T input) where T : new() class Today class Tomorrow |
Thursday, November 29, 2012
How to: invoke C# generic method dynamically
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment