LocalBuilder.LocalType Propriété

Définition

Obtient le type de la variable locale.

public:
 property Type ^ LocalType { Type ^ get(); };
public:
 virtual property Type ^ LocalType { Type ^ get(); };
public Type LocalType { get; }
public override Type LocalType { get; }
member this.LocalType : Type
Public ReadOnly Property LocalType As Type
Public Overrides ReadOnly Property LocalType As Type

Valeur de propriété

Variable Type locale.

Exemples

L’exemple de code suivant illustre l’utilisation de LocalType. Ce code fait partie d’un exemple plus grand pour la LocalBuilder classe.

// 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);
' Create local variables named myString and myInt.
Dim myLB1 As LocalBuilder = myMethodIL.DeclareLocal(GetType(String))
myLB1.SetLocalSymInfo("myString")
Console.WriteLine("local 'myString' type is: {0}", myLB1.LocalType)

Dim myLB2 As LocalBuilder = myMethodIL.DeclareLocal(GetType(Integer))
myLB2.SetLocalSymInfo("myInt", 1, 2)
Console.WriteLine("local 'myInt' type is: {0}", myLB2.LocalType)

S’applique à