LocalBuilder.LocalType Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the type of the local variable.

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public override Type LocalType { get; }

Property Value

Type: System.Type

The Type of the local variable.

The following code sample illustrates the use of LocalType. This code is part of a larger example for the LocalBuilder class.

// Create local variables named myString and myInt.
LocalBuilder myLB1 = myMethodIL.DeclareLocal(typeof(string));
myLB1.SetLocalSymInfo("myString");
Console.WriteLine("local 'myString' type is: {0}", myLB1.LocalType);

LocalBuilder myLB2 = myMethodIL.DeclareLocal(typeof(int));
myLB2.SetLocalSymInfo("myInt", 1, 2);
Console.WriteLine("local 'myInt' type is: {0}", myLB2.LocalType);

.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top
Show: