I have a class
public class A<T>
{
public static string B(T obj)
{
return TransformThisObjectToAString(obj);
}
}
The use of string above is purely exemplary. I can call the static function like this just fine on a known/specified type:
string s= A<KnownType>.B(objectOfKnownType);
How do I make this call, if I don't know T beforehand, rather I have a variable of type Type that holds the type. If I do this:
Type t= typeof(string);
string s= A<t>.B(someStringObject);
I get this compiler error:
Cannot implicitly convert type 't' to 'object'