Share via


LocalBuilder.LocalType Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the type of the local variable.

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

Syntax

'Declaration
Public Overrides ReadOnly Property LocalType As Type
public override Type LocalType { get; }

Property Value

Type: System.Type
The Type of the local variable.

Examples

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.
Dim myLB1 As LocalBuilder = myMethodIL.DeclareLocal(GetType(String))
outputBlock.Text &= String.Format("local 'myString' type is: {0}", myLB1.LocalType) & vbCrLf

Dim myLB2 As LocalBuilder = myMethodIL.DeclareLocal(GetType(Integer))
outputBlock.Text &= String.Format("local 'myInt' type is: {0}", myLB2.LocalType) & vbCrLf
// Create local variables named myString and myInt.
LocalBuilder myLB1 = myMethodIL.DeclareLocal(typeof(string));
outputBlock.Text += String.Format("local 'myString' type is: {0}\n", myLB1.LocalType);

LocalBuilder myLB2 = myMethodIL.DeclareLocal(typeof(int));
outputBlock.Text += String.Format("local 'myInt' type is: {0}\n", myLB2.LocalType);

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.