次の方法で共有


ModuleBuilder.DefineGlobalMethod Method (String, MethodAttributes, CallingConventions, Type, array<Type[])

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

Defines a global method with the specified name, attributes, calling convention, return type, and parameter types.

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

Syntax

'Declaration
Public Function DefineGlobalMethod ( _
    name As String, _
    attributes As MethodAttributes, _
    callingConvention As CallingConventions, _
    returnType As Type, _
    parameterTypes As Type() _
) As MethodBuilder
public MethodBuilder DefineGlobalMethod(
    string name,
    MethodAttributes attributes,
    CallingConventions callingConvention,
    Type returnType,
    Type[] parameterTypes
)

Parameters

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

Return Value

Type: System.Reflection.Emit.MethodBuilder
The defined global method.

Exceptions

Exception Condition
ArgumentException

The method is not static. That is, attributes does not include Static.

-or-

An element in the Type array is nulla null reference (Nothing in Visual Basic).

ArgumentNullException

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

InvalidOperationException

CreateGlobalFunctions has been previously called.

Remarks

Important noteImportant Note:

In Silverlight, global methods can be called only by code in the dynamic module.

You cannot use the global method that this method defines until you call CreateGlobalFunctions.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

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