ILGenerator.DeclareLocal Method (Type, Boolean)
Declares a local variable of the specified type, optionally pinning the object referred to by the variable.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Overridable Function DeclareLocal ( _ localType As Type, _ pinned As Boolean _ ) As LocalBuilder
- Type: System.Type
The type of the local variable.
- Type: System.Boolean
true to pin the object in memory; otherwise, false.
Return ValueType: System.Reflection.Emit.LocalBuilder
The local variable.
localType is Nothing.
The containing type has been created by the TypeBuilder.CreateType method.
The method body of the enclosing method has been created by the MethodBuilder.CreateMethodBody method.
The local variable is created in the current lexical scope; for example, if code is being emitted in a for loop (For loop in Visual Basic), the scope of the variable is the loop.
In unsafe code, an object must be pinned before it can be referred to by an unmanaged pointer. While the referenced object is pinned, it cannot be moved by garbage collection.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.