MemoryExtensions Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides extension methods for the memory-related and span-related types, such as Memory<T>, ReadOnlyMemory<T>, Span<T>, and ReadOnlySpan<T>.
public ref class MemoryExtensions abstract sealed
public static class MemoryExtensions
type MemoryExtensions = class
Public Module MemoryExtensions
- Inheritance
-
MemoryExtensions
Methods
| Name | Description |
|---|---|
| AsMemory(String, Index) |
Creates a new |
| AsMemory(String, Int32, Int32) |
Creates a new |
| AsMemory(String, Int32) |
Creates a new |
| AsMemory(String, Range) |
Creates a new |
| AsMemory(String) |
Creates a new |
| AsMemory<T>(ArraySegment<T>, Int32, Int32) |
Creates a new memory region over the portion of the target array segment beginning at a specified position with a specified length. |
| AsMemory<T>(ArraySegment<T>, Int32) |
Creates a new memory region over the portion of the target array segment starting at a specified position to the end of the segment. |
| AsMemory<T>(ArraySegment<T>) |
Creates a new memory region over the portion of the target array segment. |
| AsMemory<T>(T[], Index) |
Creates a new memory region over the portion of the target array starting at a specified index to the end of the array. |
| AsMemory<T>(T[], Int32, Int32) |
Creates a new memory region over the portion of the target array beginning at a specified position with a specified length. |
| AsMemory<T>(T[], Int32) |
Creates a new memory region over the portion of the target array starting at a specified position to the end of the array. |
| AsMemory<T>(T[], Range) |
Creates a new memory region over the portion of the target array beginning at inclusive start index of the range and ending at the exclusive end index of the range. |
| AsMemory<T>(T[]) |
Creates a new memory region over the target array. |
| AsSpan(String, Int32, Int32) |
Creates a new read-only span over a portion of the target string from a specified position for a specified number of characters. |
| AsSpan(String, Int32) |
Creates a new read-only span over a portion of the target string from a specified position to the end of the string. |
| AsSpan(String) |
Creates a new read-only span over a string. |
| AsSpan<T>(ArraySegment<T>, Index) |
Creates a new span over a portion of the target array segment beginning at a specified index and ending at the end of the segment. |
| AsSpan<T>(ArraySegment<T>, Int32, Int32) |
Creates a new span over a portion of a target array segment from a specified position for a specified length. |
| AsSpan<T>(ArraySegment<T>, Int32) |
Creates a new span over a portion of a target array segment from a specified position to the end of the segment. |
| AsSpan<T>(ArraySegment<T>, Range) |
Creates a new span over a portion of a target array segment using the range start and end indexes. |
| AsSpan<T>(ArraySegment<T>) |
Creates a new span over a target array segment. |
| AsSpan<T>(T[], Index) |
Creates a new span over the portion of the target array defined by an Index value. |
| AsSpan<T>(T[], Int32, Int32) |
Creates a new span over the portion of the target array beginning at a specified position for a specified length. |
| AsSpan<T>(T[], Int32) |
Creates a new span over a portion of the target array starting at a specified position to the end of the array. |
| AsSpan<T>(T[], Range) |
Creates a new span over a portion of a target array defined by a Range value. |
| AsSpan<T>(T[]) |
Creates a new span over a target array. |
| BinarySearch<T,TComparable>(ReadOnlySpan<T>, TComparable) |
Searches an entire sorted ReadOnlySpan<T> for a value using the specified |
| BinarySearch<T,TComparable>(Span<T>, TComparable) |
Searches an entire sorted Span<T> for a value using the specified |
| BinarySearch<T,TComparer>(ReadOnlySpan<T>, T, TComparer) |
Searches an entire sorted ReadOnlySpan<T> for a specified value using the specified |
| BinarySearch<T,TComparer>(Span<T>, T, TComparer) |
Searches an entire sorted Span<T> for a specified value using the specified |
| BinarySearch<T>(ReadOnlySpan<T>, IComparable<T>) |
Searches an entire sorted ReadOnlySpan<T> for a value using the specified IComparable<T> generic interface. |
| BinarySearch<T>(Span<T>, IComparable<T>) |
Searches an entire sorted Span<T> for a value using the specified IComparable<T> generic interface. |
| CompareTo(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) |
Compares one character span with another using a specified string comparison, and returns an integer that indicates their relative position in the sort order. |
| Contains(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) |
Indicates whether a specified value occurs within a read-only character span. |
| CopyTo<T>(T[], Memory<T>) |
Copies the contents of the array into a memory region. |
| CopyTo<T>(T[], Span<T>) |
Copies the contents of the array into the span. |
| EndsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) |
Determines whether the end of the |
| EndsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Determines whether the specified sequence appears at the end of a read-only span. |
| EndsWith<T>(Span<T>, ReadOnlySpan<T>) |
Determines whether the specified sequence appears at the end of a span. |
| Equals(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) |
Determines whether this |
| IndexOf(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) |
Reports the zero-based index of the first occurrence of the specified |
| IndexOf<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Searches for the specified sequence and returns the index of its first occurrence. |
| IndexOf<T>(ReadOnlySpan<T>, T) |
Searches for the specified value and returns the index of its first occurrence. |
| IndexOf<T>(Span<T>, ReadOnlySpan<T>) |
Searches for the specified sequence and returns the index of its first occurrence. |
| IndexOf<T>(Span<T>, T) |
Searches for the specified value and returns the index of its first occurrence. |
| IndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(ReadOnlySpan<T>, T, T, T) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(ReadOnlySpan<T>, T, T) |
Searches for the first index of either of the specified values. |
| IndexOfAny<T>(Span<T>, ReadOnlySpan<T>) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(Span<T>, T, T, T) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(Span<T>, T, T) |
Searches for the first index of any of the specified values. |
| IsWhiteSpace(ReadOnlySpan<Char>) |
Indicates whether the specified span is empty or contains only whitespace characters. |
| LastIndexOf<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Searches for the specified sequence and returns the index of its last occurrence. |
| LastIndexOf<T>(ReadOnlySpan<T>, T) |
Searches for the specified value and returns the index of its last occurrence. |
| LastIndexOf<T>(Span<T>, ReadOnlySpan<T>) |
Searches for the specified sequence and returns the index of its last occurrence. |
| LastIndexOf<T>(Span<T>, T) |
Searches for the specified value and returns the index of its last occurrence. |
| LastIndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Searches for the last index of any of the specified values. |
| LastIndexOfAny<T>(ReadOnlySpan<T>, T, T, T) |
Searches for the last index of any of the specified values. |
| LastIndexOfAny<T>(ReadOnlySpan<T>, T, T) |
Searches for the last index of any of the specified values. |
| LastIndexOfAny<T>(Span<T>, ReadOnlySpan<T>) |
Searches for the last index of any of the specified values. |
| LastIndexOfAny<T>(Span<T>, T, T, T) |
Searches for the last index of any of the specified values. |
| LastIndexOfAny<T>(Span<T>, T, T) |
Searches for the last index of any of the specified values. |
| Overlaps<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Int32) |
Determines whether two read-only sequences overlap in memory and outputs the element offset. |
| Overlaps<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Determines whether two read-only sequences overlap in memory. |
| Overlaps<T>(Span<T>, ReadOnlySpan<T>, Int32) |
Determines whether a span and a read-only span overlap in memory and outputs the element offset. |
| Overlaps<T>(Span<T>, ReadOnlySpan<T>) |
Determines whether a span and a read-only span overlap in memory. |
| Reverse<T>(Span<T>) |
Reverses the sequence of the elements in the entire span. |
| SequenceCompareTo<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Determines the relative order of two read-only sequences by comparing their elements using IComparable{T}.CompareTo(T). |
| SequenceCompareTo<T>(Span<T>, ReadOnlySpan<T>) |
Determines the relative order of a span and a read-only span by comparing the elements using IComparable{T}.CompareTo(T). |
| SequenceEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Determines whether two read-only sequences are equal by comparing the elements using IEquatable{T}.Equals(T). |
| SequenceEqual<T>(Span<T>, ReadOnlySpan<T>) |
Determines whether a span and a read-only span are equal by comparing the elements using IEquatable{T}.Equals(T). |
| StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison) |
Determines whether a read-only character span begins with a specified value when compared using a specified StringComparison value. |
| StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Determines whether a specified sequence appears at the start of a read-only span. |
| StartsWith<T>(Span<T>, ReadOnlySpan<T>) |
Determines whether a specified sequence appears at the start of a span. |
| ToLower(ReadOnlySpan<Char>, Span<Char>, CultureInfo) |
Copies the characters from the source span into the destination, converting each character to lowercase, using the casing rules of the specified culture. |
| ToLowerInvariant(ReadOnlySpan<Char>, Span<Char>) |
Copies the characters from the source span into the destination, converting each character to lowercase, using the casing rules of the invariant culture. |
| ToUpper(ReadOnlySpan<Char>, Span<Char>, CultureInfo) |
Copies the characters from the source span into the destination, converting each character to uppercase, using the casing rules of the specified culture. |
| ToUpperInvariant(ReadOnlySpan<Char>, Span<Char>) |
Copies the characters from the source span into the destination, converting each character to uppercase using the casing rules of the invariant culture. |
| Trim(ReadOnlySpan<Char>, Char) |
Removes all leading and trailing occurrences of a specified character from a read-only character span. |
| Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) |
Removes all leading and trailing occurrences of a set of characters specified in a read-only span from a read-only character span. |
| Trim(ReadOnlySpan<Char>) |
Removes all leading and trailing whitespace characters from a read-only character span. |
| TrimEnd(ReadOnlySpan<Char>, Char) |
Removes all trailing occurrences of a specified character from a read-only span. |
| TrimEnd(ReadOnlySpan<Char>, ReadOnlySpan<Char>) |
Removes all trailing occurrences of a set of characters specified in a read-only span from a read-only character span. |
| TrimEnd(ReadOnlySpan<Char>) |
Removes all trailing whitespace characters from a read-only character span. |
| TrimStart(ReadOnlySpan<Char>, Char) |
Removes all leading occurrences of a specified character from the span. |
| TrimStart(ReadOnlySpan<Char>, ReadOnlySpan<Char>) |
Removes all leading occurrences of a set of characters specified in a read-only span from the span. |
| TrimStart(ReadOnlySpan<Char>) |
Removes all leading whitespace characters from a read-only span. |