Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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.

Community Additions

ADD
Show:
© 2015 Microsoft