OpCodes.Stloc Campo

Definição

Exibe o valor atual da parte superior da pilha de avaliação e a armazena em uma lista de variáveis locais em um índice especificado.Pops the current value from the top of the evaluation stack and stores it in a the local variable list at a specified index.

public: static initonly System::Reflection::Emit::OpCode Stloc;
public static readonly System.Reflection.Emit.OpCode Stloc;
 staticval mutable Stloc : System.Reflection.Emit.OpCode
Public Shared ReadOnly Stloc As OpCode 

Valor do campo

OpCode

Comentários

A tabela a seguir lista o formato de assembly hexadecimal e da MSIL (Microsoft Intermediate Language) da instrução, juntamente com um resumo de referência breve:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

FormatarFormat Formato do assemblyAssembly Format DescriçãoDescription
< DE FE 0E unsigned int16 >FE 0E < unsigned int16 > stloc indexstloc index Exibe um valor da pilha e o armazena na variável local index .Pops a value from the stack and stores it in local variable index.

O comportamento de transição de pilha, em ordem sequencial, é:The stack transitional behavior, in sequential order, is:

  1. Um valor é retirado da pilha e colocado na variável local index .A value is popped off of the stack and placed in local variable index.

A stloc instrução exibe o valor superior da pilha de avaliação e a move para o número da variável local index , onde as variáveis locais são numeradas 0 em diante.The stloc instruction pops the top value off the evaluation stack and moves it into local variable number index, where local variables are numbered 0 onwards. O tipo do valor deve corresponder ao tipo da variável local, conforme especificado na assinatura local do método atual.The type of the value must match the type of the local variable as specified in the current method's local signature.

O armazenamento em locais que contêm um valor inteiro menor que 4 bytes trunca o valor à medida que ele se move da pilha para a variável local.Storing into locals that hold an integer value smaller than 4 bytes long truncates the value as it moves from the stack to the local variable. Os valores de ponto flutuante são arredondados de seu tamanho nativo (tipo F ) para o tamanho associado ao argumento.Floating-point values are rounded from their native size (type F) to the size associated with the argument.

As instruções corretas da MSIL (Microsoft Intermediate Language) exigem que index sejam um índice local válido.Correct Microsoft Intermediate Language (MSIL) instructions require that index be a valid local index. Para a stloc instrução, index deve estar no intervalo de 0 a 65534, inclusive (especificamente, 65535 não é válido).For the stloc instruction, index must lie in the range 0 to 65534 inclusive (specifically, 65535 is not valid). O motivo para a exclusão de 65535 é pragmático: as implementações prováveis usarão um inteiro de 2 bytes para acompanhar o índice de um local, bem como o número total de locais para um determinado método.The reason for excluding 65535 is pragmatic: likely implementations will use a 2-byte integer to track both a local's index, as well as the total number of locals for a given method. Se um índice de 65535 tiver sido tornado válido, ele exigiria um inteiro maior para controlar o número de locais em tal método.If an index of 65535 had been made valid, it would require a wider integer to track the number of locals in such a method.

As Emit sobrecargas de método a seguir podem usar o stloc opcode:The following Emit method overloads can use the stloc opcode:

Aplica-se a