Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

LocalBuilder Class

Represents a local variable within a method or constructor.


Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)
type LocalBuilder =  
        inherit LocalVariableInfo 
        interface _LocalBuilder 

The LocalBuilder type exposes the following members.

Public propertyIsPinnedGets a value indicating whether the object referred to by the local variable is pinned in memory. (Overrides LocalVariableInfo.IsPinned.)
Public propertyLocalIndexGets the zero-based index of the local variable within the method body. (Overrides LocalVariableInfo.LocalIndex.)
Public propertyLocalTypeGets the type of the local variable. (Overrides LocalVariableInfo.LocalType.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSetLocalSymInfo(String)Sets the name of this local variable.
Public methodSetLocalSymInfo(String, Int32, Int32)Sets the name and lexical scope of this local variable.
Public methodToStringReturns a user-readable string that describes the local variable. (Inherited from LocalVariableInfo.)
Explicit interface implemetationPrivate method_LocalBuilder.GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers.
Explicit interface implemetationPrivate method_LocalBuilder.GetTypeInfoRetrieves the type information for an object, which can then be used to get the type information for an interface.
Explicit interface implemetationPrivate method_LocalBuilder.GetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1).
Explicit interface implemetationPrivate method_LocalBuilder.InvokeProvides access to properties and methods exposed by an object.

A LocalBuilder object can be defined using the DeclareLocal method.

The following example creates a static method (Shared in Visual Basic) named Function1 that returns a string and has a parameter of type Int32. In the body of the method, the code example creates LocalBuilder objects representing two local variables, and sets symbol information for the local variables. The method does not do anything significant, but the method body demonstrates storing a parameter to a local variable, storing a literal string to a local variable, and loading a local variable.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.