NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Defining a Method

This section describes how to define global methods and methods as type members using the Reflection Emit APIs. The APIs that define methods return MethodBuilder objects.

The MethodBuilder.AddDeclarativeSecurity method adds declarative security to a method being built. AddDeclarativeSecurity may be called several times with each call specifying a security action (e.g., Demand, Assert, Deny) and a set of permissions that the action applies to.

A global method is defined using the ModuleBuilder.DefineGlobalMethod method. DefineGlobalMethod returns a MethodBuilder object.

Global methods must be static. If a dynamic module contains global methods, the method ModuleBuilder.CreateGlobalFunctions must be called before persisting the dynamic module or the containing dynamic assembly. This is because the runtime postpones fixing up the dynamic module until all global functions have been defined.

A global native method is defined using the method ModuleBuilder.DefinePInvokeMethod. PInvoke methods must not be declared abstract or virtual. The runtime sets the MethodAttributes.PinvokeImpl attribute for a PInvoke method.

A method is defined as a type member using the TypeBuilder.DefineMethod method. DefineMethod returns a MethodBuilder object.

A PInvoke method is defined as a type member using the method TypeBuilder.DefinePInvokeMethod. DefinePInvokeMethod returns a MethodBuilder object. PInvoke methods must not be declared abstract or virtual. The runtime sets the MethodAttributes.PinvokeImpl attribute for a PInvoke method.

Attributes

Known Issues