Поделиться через


LocalBuilder.LocalType Свойство

Определение

Возвращает тип локальной переменной.

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

Значение свойства

Объект Type данной локальной переменной.

Примеры

В следующем примере кода показано использование LocalType. Этот код является частью более крупного примера для LocalBuilder класса .

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

LocalBuilder^ myLB2 = myMethodIL->DeclareLocal( int::typeid );
myLB2->SetLocalSymInfo( "myInt", 1, 2 );
Console::WriteLine( "local 'myInt' type is: {0}", myLB2->LocalType );
// 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)

Применяется к