Activate object from ParameterType value.
Posted on 2007-10-16
I need to instantiate an object of type someParameterInfo.ParameterType.
Basically, I want to reconstitute the parameter type of a method by calling something like this:
ParameterType p = some parameterType;
Type t = Type.GetType(p.FullName); // does not work
object obj = Activator.CreateInstance(t);
Where t is type System.Int32 or the like. I would think that p.FullName would give me "System.Int32" but it does not.