DynamicMethod.InitLocals 속성

정의

메서드의 로컬 변수가 0으로 초기화되었는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

메서드의 로컬 변수가 0으로 초기화되었으면true 이고, 초기화되지 않았으면 false입니다. 기본값은 true입니다.

예제

다음 코드 예제에서는 InitLocals 동적 메서드의 속성을 표시 합니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 DynamicMethod 클래스입니다.

// 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)

설명

이 속성이 로 true설정된 경우 내보낸 MSIL(Microsoft Intermediate Language)에는 지역 변수의 초기화가 포함됩니다. 로 설정된 false경우 지역 변수가 초기화되지 않고 생성된 코드를 확인되지 않습니다.

적용 대상