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!

Emiting IL Instructions

The ILGenerator class provides methods that can be used to emit IL. ConstructorBuilder.GetILGenerator returns an ILGenerator object for a constructor. MethodBuilder.GetILGenerator returns an ILGenerator object for a method. The following services are provided by the ILGenerator class:

For catch handlers, the sequence of calls should resemble the following template:
Emit some IL
BeginExceptionBlock
Emit the IL for the try block.
BeginCatchBlock
Emit the IL for the handler
BeginCatchBlock
Emit the IL for the handler
BeginFaultBlock
Emit the IL for the fault block
BeginFinallyBlock
Emit the IL for the finally block
EndExceptionBlock
For filtered handlers, the sequence of calls should resemble the following template:
Emit some IL
BeginExceptionBlock
Emit the IL for the try block.
BeginExceptFilterBlock
Emit the IL for the filtered exception handler
BeginCatchBlock
Emit the IL for the catch block. The catch handler should be supplied with a null type.
BeginFaultBlock
Emit the IL for the fault block
BeginFinallyBlock
Emit the IL for the finally block
EndExceptionBlock