How to Pass Parameters to Activator.CreateInstance()
Yes. (T)Activator.CreateInstance(typeof(T), param1, param2);
Yes. (T)Activator.CreateInstance(typeof(T), param1, param2);
I did some benchmarking between these (I would write down the bare minimum details): public static T Instance() //~1800 ms { return new T(); } public static T Instance() //~1800 ms { return new Activator.CreateInstance<T>(); } public static readonly Func<T> Instance = () => new T(); //~1800 ms public static readonly Func<T> Instance = () … Read more