TypeBuilder::DefineProperty Method (String^, PropertyAttributes, CallingConventions, Type^, array<Type^>^, array<Type^>^, array<Type^>^, array<array<Type^>^>^, array<array<Type^>^>^)
Adds a new property to the type, with the given name, calling convention, property signature, and custom modifiers.
Assembly: mscorlib (in mscorlib.dll)
public: PropertyBuilder^ DefineProperty( String^ name, PropertyAttributes attributes, CallingConventions callingConvention, Type^ returnType, array<Type^>^ returnTypeRequiredCustomModifiers, array<Type^>^ returnTypeOptionalCustomModifiers, array<Type^>^ parameterTypes, array<array<Type^>^>^ parameterTypeRequiredCustomModifiers, array<array<Type^>^>^ parameterTypeOptionalCustomModifiers )
Parameters
- name
-
Type:
System::String^
The name of the property. name cannot contain embedded nulls.
- attributes
-
Type:
System.Reflection::PropertyAttributes
The attributes of the property.
- callingConvention
-
Type:
System.Reflection::CallingConventions
The calling convention of the property accessors.
- returnType
-
Type:
System::Type^
The return type of the property.
- returnTypeRequiredCustomModifiers
-
Type:
array<System::Type^>^
An array of types representing the required custom modifiers, such as IsConst, for the return type of the property. If the return type has no required custom modifiers, specify null.
- returnTypeOptionalCustomModifiers
-
Type:
array<System::Type^>^
An array of types representing the optional custom modifiers, such as IsConst, for the return type of the property. If the return type has no optional custom modifiers, specify null.
- parameterTypes
-
Type:
array<System::Type^>^
The types of the parameters of the property.
- parameterTypeRequiredCustomModifiers
-
Type:
array<array<System::Type^>^>^
An array of arrays of types. Each array of types represents the required custom modifiers for the corresponding parameter, such as IsConst. If a particular parameter has no required custom modifiers, specify null instead of an array of types. If none of the parameters have required custom modifiers, specify null instead of an array of arrays.
- parameterTypeOptionalCustomModifiers
-
Type:
array<array<System::Type^>^>^
An array of arrays of types. Each array of types represents the optional custom modifiers for the corresponding parameter, such as IsConst. If a particular parameter has no optional custom modifiers, specify null instead of an array of types. If none of the parameters have optional custom modifiers, specify null instead of an array of arrays.
| Exception | Condition |
|---|---|
| ArgumentException | The length of name is zero. |
| ArgumentNullException | name is null. -or- Any of the elements of the parameterTypes array is null. |
| InvalidOperationException | The type was previously created using CreateType. |
This overload is provided for designers of managed compilers.
Note |
|---|
For more information on custom modifiers, see the ECMA Partition II Metadata documentation. The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site. |
This method overload is introduced in the .NET Framework 3.5 or later.
Available since 2.0
Silverlight
Available since 5.0
