Home > Net > The Assembly. The problem of CreateInstance great spirit
The Assembly. The problem of CreateInstance great spirit
Time:09-30
I have 2 classes under a set of procedures, can use reflection to create a class instance, what is a class is empty The Assembly Assembly=Assembly. The Load (" Cjf. Dal "); Object obj1=assembly. CreateInstance (" Cjf. Dal. BookInfoDal "); Object obj2=assembly. CreateInstance (" Cjf. Dal. BookTypeDal "); An assembly that is not empty, obj1 can create instances, but obj2 returns null is something wrong
CodePudding user response:
The source code. You can open the Assembly CreateIntance see bai, a total of only three or four lines of code,
Whenever possible, should be combined with the.net framework source code to learn. The net, this is a must skill,
Or what is called studied the.net? Read the source code can distinguish between a programmer did beneath the surface potential,
CodePudding user response:
You can think of there are so few things 1, there is no Cjf. Dal. BookTypeDal this class, spelt wrong 2, Cjf. Dal. BookTypeDal not public 3, Cjf. Dal. BookTypeDal no default constructor 4, Cjf. Dal. BookTypeDal is abstract, not structure