Export (0) Print
Expand All

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

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)

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.
attributes
Type: System.Reflection.MethodAttributes
The attributes of the method. attributes must include Static.
callingConvention
Type: System.Reflection.CallingConventions
The calling convention for the method.
returnType
Type: System.Type
The return type of the method.
parameterTypes
Type: System.Type[]
The types of the method's parameters.

Return Value

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

ExceptionCondition
ArgumentException

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

-or-

An element in the Type array is null.

ArgumentNullException

name is null.

InvalidOperationException

CreateGlobalFunctions has been previously called.

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.

Silverlight

Supported in: 5, 4, 3

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

Community Additions

ADD
Show:
© 2014 Microsoft