I have a method that requires a T
to function properly. I have a Type
object as a property of my class.
public Type DefaultNumaricType {get; private set;} = typeof(double);
private T Convert<T>(string input)
{
...
}
I want to be able to call the Convert<T>
method and get an object of the type specified in DefaultNumaricType
.
Is something like this possible:
double d = Convert<DefaultNumaricType>("123.00");