Skip to content

Latest commit

 

History

History
21 lines (12 loc) · 718 Bytes

iii.4.12-ldlen.md

File metadata and controls

21 lines (12 loc) · 718 Bytes

III.4.12 ldlen – load the length of an array

Format Assembly Format Description
8E ldlen Push the length (of type native unsigned int) of array on the stack.

Stack Transition:

…, array → …, length

Description:

The ldlen instruction pushes the number of elements of array (a zero-based, one-dimensional array) on the stack. Arrays are objects and hence represented by a value of type O. The return value is a native unsigned int.

Exceptions:

System.NullReferenceException is thrown if array is null.

Correctness:

Correct CIL ensures that array is indeed always null or a zero-based, one dimensional array.