I am trying to cast an object using generic arguments in C# like
(foo<mypara>)obj
where the mypara
is a generic argument.
public class foo<T>
{
public string name {get;set;}
public func<T> value {get;set;}
}
var mypara = myfoo.GetType().GetGenericArguments();
where the value of mypara.Name
is "int"
or "string"
, which is actually a string representation of the type.
But how can I get the real type of mypara?