Skip to content
CShift0.32

ReadOnlySlice<T>

Struct · built-in type

struct ReadOnlySlice<T>

A read-only view of elements: a Slice, an array, or a constant (const ReadOnlySlice<int> Primes = [2, 3, 5];, Enum<T>.Values, embed("*.txt")).

A function that takes a ReadOnlySlice<T> accepts arrays, slices and constants alike. It can also be a parameter of a thread function when its elements can be copied between threads (the thread gets its own copy).

Name Description
Length The number of elements.
int Length

The number of elements.

Name Description
ToArray A new array with the elements.
Ptr A pointer to the first element (unsafe).
T[] ToArray()

A new array with the elements.

T* Ptr()

A pointer to the first element (unsafe).