Home > Net >  The Activator. The abnormal CreateInstance beg god help!!
The Activator. The abnormal CreateInstance beg god help!!

Time:01-10

Wrote a piece of code, with the help of the Activator. The CreateInstance, but abnormal, the great god, please help me solve the ~ ~
Specific code is as follows:
Type Type=triggerID. GetType ();
Console. WriteLine (type);
The object result=null;
Result=the Activator. CreateInstance (type);
FSMTrigger tr=result as FSMTrigger;

The Activator. The CreateInstance throws an exception, the exception is shown in figure:

Then can make a successful assignment result, but the tr after transformation type is null, FSMTrigger as abstract class
Where is no problem, please god help me ~ ~
  •  Tags:  
  • C#
  • Related