Create an instance of a Generic Type and invoke its method
suggest changevar baseType = typeof(List<>);
var genericType = baseType.MakeGenericType(typeof(String));
var instance = Activator.CreateInstance(genericType);
var method = genericType.GetMethod("GetHashCode");
var result = method.Invoke(instance, new object[] { });
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents