AsMemory()

System::MemoryExtensions::AsMemory(const System::String&) function

Creates a read-only memory from a string.

ReadOnlyMemory<char16_t> System::MemoryExtensions::AsMemory(const System::String &text)

Arguments

ParameterTypeDescription
textconst System::String&The source string.

Return Value

ReadOnlyMemory<char16_t> covering the specified portion of the string.

Remarks

On C++ side this will be copy of string contents, not slice of existing string.

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

Creates a read-only memory from a string slice.

ReadOnlyMemory<char16_t> System::MemoryExtensions::AsMemory(const System::String &text, int32_t start)

Arguments

ParameterTypeDescription
textconst System::String&The source string.
startint32_tThe starting index in the string.

Return Value

ReadOnlyMemory<char16_t> covering the specified portion of the string.

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

Creates a read-only memory from a string slice.

ReadOnlyMemory<char16_t> System::MemoryExtensions::AsMemory(const System::String &text, int32_t start, int32_t length)

Arguments

ParameterTypeDescription
textconst System::String&The source string.
startint32_tThe starting index in the string.
lengthint32_tThe length of the memory slice.

Return Value

ReadOnlyMemory<char16_t> covering the specified portion of the string.

System::MemoryExtensions::AsMemory(const ArrayPtr<T>&) function

Creates a mutable memory from an array.

template<typename T> Memory<T> System::MemoryExtensions::AsMemory(const ArrayPtr<T> &array)

Template parameters

ParameterDescription
TThe type of elements in the array.

Arguments

ParameterTypeDescription
arrayconst ArrayPtr<T>&The source array.

Return Value

Memory wrapping the entire array.

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

Creates a mutable memory from an array slice.

template<typename T> Memory<T> System::MemoryExtensions::AsMemory(const ArrayPtr<T> &array, int32_t start)

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.

Return Value

Memory covering the specified portion of the array.

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

Creates a mutable memory from an array slice.

template<typename T> Memory<T> System::MemoryExtensions::AsMemory(const ArrayPtr<T> &array, int32_t start, int32_t length)

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 memory slice.

Return Value

Memory covering the specified portion of the array.

System::MemoryExtensions::AsMemory(const ArraySegment<T>&) function

Creates a mutable memory from an array segment.

template<typename T> Memory<T> System::MemoryExtensions::AsMemory(const ArraySegment<T> &segment)

Template parameters

ParameterDescription
TThe type of elements in the array.

Arguments

ParameterTypeDescription
segmentconst ArraySegment<T>&The source array segment.

Return Value

Memory covering the specified portion of the array.

System::MemoryExtensions::AsMemory(const ArrayPtr<T>&, const Range&) function

Creates a mutable memory from a range within an array.

template<typename T> Memory<T> System::MemoryExtensions::AsMemory(const ArrayPtr<T> &array, const Range &range)

Template parameters

ParameterDescription
TThe type of elements in the array.

Arguments

ParameterTypeDescription
arrayconst ArrayPtr<T>&The source array.
rangeconst Range&The range of elements to include in the memory.

Return Value

Memory covering the specified portion of the array.

See Also