AsSpan()

System::MemoryExtensions::AsSpan(const String&, int32_t, int32_t) function

Creates a read-only span from a string.

ReadOnlySpan<char16_t> System::MemoryExtensions::AsSpan(const String &text, int32_t start=0, int32_t length=-1)

Arguments

ParameterTypeDescription
textconst String&The source string.
startint32_tThe starting index in the string.
lengthint32_tThe length of the span.

Return Value

ReadOnlySpan<char16_t> spanning the specified portion of the string.

System::MemoryExtensions::AsSpan(const ArrayPtr<T>&, int32_t, int32_t) function

Creates a span from an array.

template<typename T> Span<T> System::MemoryExtensions::AsSpan(const ArrayPtr<T> &array, int32_t start=0, int32_t length=-1)

Template parameters

ParameterDescription
TThe type of elements in the array.

Arguments

ParameterTypeDescription
arrayconst ArrayPtr<T>&The source array.
startint32_tThe starting index in the array.
lengthint32_tThe length of the span.

Return Value

Span spanning the specified portion of the array.

See Also