共用方式為


DynamicMethod Constructor (String, Type, array<Type[], Type)

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

This member can be used only by trusted applications. If you try to use this member in a partial-trust application, your code will throw a MethodAccessException exception. This member is security-critical, which restricts its use.

[SECURITY CRITICAL]

Creates a dynamic method, specifying the method name, return type, parameter types, and the type with which the dynamic method is logically associated.

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

Syntax

'Declaration
<SecurityCriticalAttribute> _
Public Sub New ( _
    name As String, _
    returnType As Type, _
    parameterTypes As Type(), _
    owner As Type _
)
[SecurityCriticalAttribute]
public DynamicMethod(
    string name,
    Type returnType,
    Type[] parameterTypes,
    Type owner
)

Parameters

  • name
    Type: System.String
    The name of the dynamic method. This can be a zero-length string, but it cannot be nulla null reference (Nothing in Visual Basic).
  • returnType
    Type: System.Type
    A Type object that specifies the return type of the dynamic method, or nulla null reference (Nothing in Visual Basic) if the method has no return type.
  • parameterTypes
    Type: array<System.Type[]
    An array of Type objects specifying the types of the parameters of the dynamic method, or nulla null reference (Nothing in Visual Basic) if the method has no parameters.
  • owner
    Type: System.Type
    A Type with which the dynamic method is logically associated. The dynamic method has access to all members of the type.

Version Information

Silverlight

Supported in: 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

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