Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​ReadOnlyMemory`1
Assembly: System.Runtime
Represents a contiguous region of memory, similar to <see cref="T:System.ReadOnlySpan`1" /> . Unlike <see cref="T:System.ReadOnlySpan`1" /> , it is not a byref-like type.
Properties
public
bool
IsEmpty
Gets a value that indicates whether this read-only memory region is empty.
public
int
Length
Gets the number of items in the memory region.
public
ReadOnlySpan`1
Span
Gets a span from the memory region.
Methods
public
bool
Equals​(object obj)
obj
The object to compare.
Returns <see langword="true" /> if the current instance and <paramref name="obj" /> are equal; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current read-only memory region.
public
int
GetHashCode​() Returns The hash code.
Returns the hash code for this <see cref="T:System.ReadOnlyMemory`1" /> .
Creates a handle for the memory.
public
ReadOnlyMemory`1
Slice​(int start)
start
The index at which to begin this slice.
Returns A read-only memory region representing the desired slice.
Forms a slice out of the given memory region, beginning at a specified position and continuing to its end.
public
ReadOnlyMemory`1
Slice​(int start,
int length)
start
The index at which to begin this slice.
length
The desired length for the slice.
Returns A read-only memory region representing the desired slice.
Forms a slice out of the given memory region starting at <paramref name="start" /> position for <paramref name="length" /> elements.
public
T[]
ToArray​() Returns An array.
Copies the contents from the memory region into a new array.
public
string
ToString​() Returns For <see cref="T:System.ReadOnlyMemory`1" /> with char elements, returns an instance of string that represents the characters pointed to by the memory. Otherwise, returns a <see cref="T:System.String" /> with the name of the type and the number of elements.
Returns the string representation of this read-only memory instance.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .