TypeBuilder.DefineProperty Method (String, PropertyAttributes, CallingConventions, Type, array<Type[])

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Adds a new property to the type, with the given name, attributes, calling convention, and property signature.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Function DefineProperty ( _
    name As String, _
    attributes As PropertyAttributes, _
    callingConvention As CallingConventions, _
    returnType As Type, _
    parameterTypes As Type() _
) As PropertyBuilder
public PropertyBuilder DefineProperty(
    string name,
    PropertyAttributes attributes,
    CallingConventions callingConvention,
    Type returnType,
    Type[] parameterTypes
)

Parameters

  • name
    Type: System.String
    The name of the property. name cannot contain embedded nulls.
  • returnType
    Type: System.Type
    The return type of the property.
  • parameterTypes
    Type: array<System.Type[]
    The types of the parameters of the property.

Return Value

Type: System.Reflection.Emit.PropertyBuilder
The defined property.

Exceptions

Exception Condition
ArgumentException

The length of name is zero.

ArgumentNullException

name is nulla null reference (Nothing in Visual Basic).

-or-

Any of the elements of the parameterTypes array is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

The type was previously created using CreateType.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.