Link to home
Start Free TrialLog in
Avatar of neudeal
neudeal

asked on

Activate object from ParameterType value.

Hello,

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.

Any suggestions?

Thanks,
Robert
ASKER CERTIFIED SOLUTION
Avatar of ripahoratiu
ripahoratiu
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
*sry, replace all ParameterType with some specific type of the parameter (i.e. String, MyClass, etc.)
Forced accept.

Computer101
EE Admin