Share via


DynamicMethod.InitLocals Özellik

Tanım

yöntemindeki yerel değişkenlerin sıfırdan başlatılıp başlatılmadığını belirten bir değer alır veya ayarlar.

public:
 property bool InitLocals { bool get(); void set(bool value); };
public bool InitLocals { get; set; }
member this.InitLocals : bool with get, set
Public Property InitLocals As Boolean

Özellik Değeri

true yöntemindeki yerel değişkenler sıfır başlatıldıysa; aksi takdirde , false. Varsayılan değer: true.

Örnekler

Aşağıdaki kod örneği, dinamik bir yöntemin özelliğini görüntüler InitLocals . Bu kod örneği, sınıfı için DynamicMethod sağlanan daha büyük bir örneğin parçasıdır.

// Display the default value for InitLocals.
if (hello->InitLocals)
{
    Console::Write("\r\nThis method contains verifiable code.");
}
else
{
    Console::Write("\r\nThis method contains unverifiable code.");
}
Console::WriteLine(" (InitLocals = {0})", hello->InitLocals);
// Display the default value for InitLocals.
if (hello.InitLocals)
{
    Console.Write("\r\nThis method contains verifiable code.");
}
else
{
    Console.Write("\r\nThis method contains unverifiable code.");
}
Console.WriteLine(" (InitLocals = {0})", hello.InitLocals);
' Display the default value for InitLocals.
If hello.InitLocals Then
    Console.Write(vbCrLf & "This method contains verifiable code.")
Else
    Console.Write(vbCrLf & "This method contains unverifiable code.")
End If
Console.WriteLine(" (InitLocals = {0})", hello.InitLocals)

Açıklamalar

Bu özellik olarak trueayarlanırsa, yayılan Microsoft ara dili (MSIL) yerel değişkenlerin başlatılmasını içerir. olarak ayarlanırsa false, yerel değişkenler başlatılmaz ve oluşturulan kod doğrulanamaz.

Şunlara uygulanır