neudeal
asked on
Activate object from ParameterType value.
Hello,
I need to instantiate an object of type someParameterInfo.Paramete rType.
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.
Any suggestions?
Thanks,
Robert
I need to instantiate an object of type someParameterInfo.Paramete
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.
Any suggestions?
Thanks,
Robert
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
*sry, replace all ParameterType with some specific type of the parameter (i.e. String, MyClass, etc.)
Forced accept.
Computer101
EE Admin
Computer101
EE Admin