共用方式為


Defining a Property With Reflection Emit 

A property is defined using the TypeBuilder.DefineProperty method. DefineProperty returns a PropertyBuilder. The DefineProperty method requires the caller to specify the property name, the signature of the property, the property attributes (using the PropertyAttributes enumeration), and the backing field.

The PropertyBuilder class allows the caller to specify the getter method, the setter method, and any other methods.

The default value of the property can be set using PropertyBuilder.SetConstant.

See Also

Other Resources

Using Reflection Emit