Format | Assembly Format | Description |
---|---|---|
A3 <T> | ldelem typeTok |
Load the element at index onto the top of the stack. |
…, array, index → …, value
The ldelem
instruction loads the value of the element with index index (of type native int
or int32
) in the zero-based one-dimensional array array, and places it on the top of the stack. The type of the return value is indicated by the type token typeTok in the instruction. If required elements are converted to the representation of their intermediate type (§I.8.7) when loaded onto the stack (§III.1.1.1).
[Note: that is elements that are smaller than 4 bytes, a boolean or a character are converted to 4 bytes by sign or zero-extension as appropriate. Floating-point values are converted to their native size (type F
). end note]
System.IndexOutOfRangeException
is thrown if index is larger than the bound of array.
System.NullReferenceException
is thrown if array is null.
typeTok shall be a valid typedef
, typeref
, or typespec
metadata token.
array shall be either null or a single dimensional, zero-based array.
Verification requires that:
-
the tracked type of array is
T[]
, for someT
; -
T
is array-element-compatible-with (§I.8.7.1) typeTok; and -
the type of index is
int32
ornative int
.
Verification tracks the type of the result value as typeTok.