In C# I have a function that accepts <T>. Currently I am creating an instance using Activator.CreateInstance<T>().
Is there a way to detect the parameters of <T> at run time so I can create <T> with parameters?
Method stub is like below:
public static T Get<T>()
{
}
You need to bear in mind that any particular type can have multiple constructors. You can find them all easily enough though:
Note that
Type.GetConstructorshas an overload taking aBindingFlagsin case you want to find non-public constructors.