DynamicMethod.InitLocals Proprietà
Definizione
Ottiene o imposta un valore che indica se le variabili locali nel metodo sono inizializzate su zero.Gets or sets a value indicating whether the local variables in the method are zero-initialized.
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
Valore della proprietà
true
se le variabili locali nel metodo vengono inizializzate su zero; in caso contrario, false
.true
if the local variables in the method are zero-initialized; otherwise, false
. Il valore predefinito è true
.The default is true
.
Esempio
Nell'esempio di codice seguente viene visualizzata la InitLocals proprietà di un metodo dinamico.The following code example displays the InitLocals property of a dynamic method. Questo esempio di codice fa parte di un esempio più ampio fornito per la DynamicMethod classe.This code example is part of a larger example provided for the DynamicMethod class.
// 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)
Commenti
Se questa proprietà è impostata su true
, il codice MSIL (Microsoft Intermediate Language) emesso include l'inizializzazione di variabili locali.If this property is set to true
, the emitted Microsoft intermediate language (MSIL) includes initialization of local variables. Se è impostato su false
, le variabili locali non vengono inizializzate e il codice generato non è verificabile.If it is set to false
, local variables are not initialized and the generated code is unverifiable.