Define the constructor of the class through the TypeBuilder
In TypeBuilder you can use two method to define the constructor of the Type(class): DefineDefaultConstructor and DefineConstructor .
DefineDefaultConstructor generates a default constructor. There aren't any codes except for the code of invoking the default constructor of the parent class(no parameter) in the constructor. You can’t add any codes to the constructor, namely the ILGenerator can’t be invoked in the default constructor.
DefineConstructor generates a common constructor. Any codes can be added to the constructor.
DefineDefaultConstructor generates a default constructor. There aren't any codes except for the code of invoking the default constructor of the parent class(no parameter) in the constructor. You can’t add any codes to the constructor, namely the ILGenerator can’t be invoked in the default constructor.
DefineConstructor generates a common constructor. Any codes can be added to the constructor.
浙公网安备 33010602011771号