CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
System::ReadOnlyMemory< T > Class Template Reference

Represents a read-only memory segment backed by an array. More...

#include <memory.h>

Inherits System::Details::MemoryCore< T >.

Public Member Functions

ReadOnlySpan< T > get_Span () const
 Gets a read-only span that represents the current memory. More...
 
ReadOnlyMemory Slice (int32_t start, int32_t length) const
 Creates a slice of the current readonly memory. More...
 
template<typename T1 = T>
std::enable_if< std::is_same< T1, char16_t >::value, String >::type ToString () const
 Converts the character read-only memory to a string representation. More...
 
template<typename T1 = T>
std::enable_if<!std::is_same< T1, char16_t >::value, String >::type ToString () const
 Converts the ordinary read-only memory to a string representation. More...
 

Static Public Member Functions

static ReadOnlyMemory get_Empty ()
 Gets an empty ReadOnlyMemory instance. More...
 
static ReadOnlyMemory to_ReadOnlyMemory (const ArrayPtr< T > &array)
 Creates a ReadOnlyMemory instance from the specified array. More...
 

Detailed Description

template<typename T>
class System::ReadOnlyMemory< T >

Represents a read-only memory segment backed by an array.

Exposes a read-only span over the array region and supports slicing.

Member Function Documentation

◆ get_Empty()

template<typename T >
static ReadOnlyMemory System::ReadOnlyMemory< T >::get_Empty ( )
inlinestatic

Gets an empty ReadOnlyMemory instance.

Returns
An empty ReadOnlyMemory object.

◆ get_Span()

template<typename T >
ReadOnlySpan< T > System::ReadOnlyMemory< T >::get_Span ( ) const
inline

Gets a read-only span that represents the current memory.

Returns
A read-only span over the memory segment.

◆ Slice()

template<typename T >
ReadOnlyMemory System::ReadOnlyMemory< T >::Slice ( int32_t  start,
int32_t  length 
) const
inline

Creates a slice of the current readonly memory.

Parameters
startThe starting index of the slice.
lengthThe number of elements in the slice.
Returns
A ReadOnlyMemory object representing the requested slice.

◆ to_ReadOnlyMemory()

template<typename T >
static ReadOnlyMemory System::ReadOnlyMemory< T >::to_ReadOnlyMemory ( const ArrayPtr< T > &  array)
inlinestatic

Creates a ReadOnlyMemory instance from the specified array.

Parameters
arrayThe source array.
Returns
A ReadOnlyMemory object that wraps the array.

◆ ToString() [1/2]

template<typename T >
template<typename T1 = T>
std::enable_if< std::is_same< T1, char16_t >::value, String >::type System::ReadOnlyMemory< T >::ToString ( ) const
inline

Converts the character read-only memory to a string representation.

Returns
A string representing the memory.

◆ ToString() [2/2]

template<typename T >
template<typename T1 = T>
std::enable_if<!std::is_same< T1, char16_t >::value, String >::type System::ReadOnlyMemory< T >::ToString ( ) const
inline

Converts the ordinary read-only memory to a string representation.

Returns
A string representing the memory.