# System ``` diff namespace System { - public readonly struct Memory { + public readonly struct Memory : IEquatable> { - public Memory this[Range range] { get; } - public Memory Slice(Index startIndex); - public Memory Slice(Range range); } public static class MemoryExtensions { + public static Memory Trim(this Memory memory); + public static ReadOnlyMemory Trim(this ReadOnlyMemory memory); + public static Span Trim(this Span span); + public static Memory Trim(this Memory memory, ReadOnlySpan trimElements) where T : IEquatable; + public static Memory Trim(this Memory memory, T trimElement) where T : IEquatable; + public static ReadOnlyMemory Trim(this ReadOnlyMemory memory, ReadOnlySpan trimElements) where T : IEquatable; + public static ReadOnlyMemory Trim(this ReadOnlyMemory memory, T trimElement) where T : IEquatable; + public static ReadOnlySpan Trim(this ReadOnlySpan memory, ReadOnlySpan trimElements) where T : IEquatable; + public static ReadOnlySpan Trim(this ReadOnlySpan memory, T trimElement) where T : IEquatable; + public static Span Trim(this Span memory, ReadOnlySpan trimElements) where T : IEquatable; + public static Span Trim(this Span memory, T trimElement) where T : IEquatable; + public static Memory TrimEnd(this Memory memory); + public static ReadOnlyMemory TrimEnd(this ReadOnlyMemory memory); + public static Span TrimEnd(this Span span); + public static Memory TrimEnd(this Memory memory, ReadOnlySpan trimElements) where T : IEquatable; + public static Memory TrimEnd(this Memory memory, T trimElement) where T : IEquatable; + public static ReadOnlyMemory TrimEnd(this ReadOnlyMemory memory, ReadOnlySpan trimElements) where T : IEquatable; + public static ReadOnlyMemory TrimEnd(this ReadOnlyMemory memory, T trimElement) where T : IEquatable; + public static ReadOnlySpan TrimEnd(this ReadOnlySpan memory, ReadOnlySpan trimElements) where T : IEquatable; + public static ReadOnlySpan TrimEnd(this ReadOnlySpan memory, T trimElement) where T : IEquatable; + public static Span TrimEnd(this Span memory, ReadOnlySpan trimElements) where T : IEquatable; + public static Span TrimEnd(this Span memory, T trimElement) where T : IEquatable; + public static Memory TrimStart(this Memory memory); + public static ReadOnlyMemory TrimStart(this ReadOnlyMemory memory); + public static Span TrimStart(this Span span); + public static Memory TrimStart(this Memory memory, ReadOnlySpan trimElements) where T : IEquatable; + public static Memory TrimStart(this Memory memory, T trimElement) where T : IEquatable; + public static ReadOnlyMemory TrimStart(this ReadOnlyMemory memory, ReadOnlySpan trimElements) where T : IEquatable; + public static ReadOnlyMemory TrimStart(this ReadOnlyMemory memory, T trimElement) where T : IEquatable; + public static ReadOnlySpan TrimStart(this ReadOnlySpan memory, ReadOnlySpan trimElements) where T : IEquatable; + public static ReadOnlySpan TrimStart(this ReadOnlySpan memory, T trimElement) where T : IEquatable; + public static Span TrimStart(this Span memory, ReadOnlySpan trimElements) where T : IEquatable; + public static Span TrimStart(this Span memory, T trimElement) where T : IEquatable; } public readonly struct Range : IEquatable { - public Range.OffsetAndLength GetOffsetAndLength(int length); + public ValueTuple GetOffsetAndLength(int length); - public readonly struct OffsetAndLength { { - public OffsetAndLength(int offset, int length); - public int Length { get; } - public int Offset { get; } - public void Deconstruct(out int offset, out int length); - } } - public readonly struct ReadOnlyMemory { + public readonly struct ReadOnlyMemory : IEquatable> { - public ReadOnlyMemory this[Range range] { get; } - public ReadOnlyMemory Slice(Index startIndex); - public ReadOnlyMemory Slice(Range range); } public readonly ref struct ReadOnlySpan { - public ref readonly T this[Index index] { get; } - public ReadOnlySpan this[Range range] { get; } - public ReadOnlySpan Slice(Index startIndex); - public ReadOnlySpan Slice(Range range); } public readonly ref struct Span { - public ref T this[Index index] { get; } - public Span this[Range range] { get; } - public Span Slice(Index startIndex); - public Span Slice(Range range); } public sealed class String : ICloneable, IComparable, IComparable, IConvertible, IEnumerable, IEnumerable, IEquatable { - [System.Runtime.CompilerServices.IndexerName("Chars")] - public char this[Index index] { get; } - [System.Runtime.CompilerServices.IndexerName("Chars")] - public string this[Range range] { get; } + public ref readonly char GetPinnableReference(); - public String Substring(Index startIndex); - public String Substring(Range range); } } ```