<PackageReference Include="System.Memory" Version="4.6.0" />

SpanHelpers

static class SpanHelpers
public static class PerTypeValues<T>

public static IntPtr Add<T>(this IntPtr start, int index)

Computes "start + index * sizeof(T)", using the unsigned IntPtr-sized multiplication for 32 and 64 bits. Assumptions: Start and index are non-negative, and already pre-validated to be within the valid range of their containing Span. If the byte length (Span.Length * sizeof(T)) does an unsigned overflow (i.e. the buffer wraps or is too big to fit within the address space), the behavior is undefined.

public static int BinarySearch<T, TComparable>(this ReadOnlySpan<T> span, TComparable comparable) where TComparable : IComparable<T>

public static int BinarySearch<T, TComparable>(ref T spanStart, int length, TComparable comparable) where TComparable : IComparable<T>

public static void ClearLessThanPointerSized(Byte* ptr, UIntPtr byteLength)

public static void ClearLessThanPointerSized(ref byte b, UIntPtr byteLength)

public static void ClearPointerSizedWithoutReferences(ref byte b, UIntPtr byteLength)

public static void ClearPointerSizedWithReferences(ref IntPtr ip, UIntPtr pointerSizeLength)

public static void CopyTo<T>(ref T dst, int dstLength, ref T src, int srcLength)

Implements the copy functionality used by Span and ReadOnlySpan. NOTE: Fast span implements TryCopyTo in corelib and therefore this implementation is only used by portable span. The code must live in code that only compiles for portable span which means either each individual span implementation of this shared code file. Other shared SpanHelper.X.cs files are compiled for both portable and fast span implementations.

public static int IndexOf(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)

public static int IndexOf(ref byte searchSpace, byte value, int length)

public static int IndexOf(ref char searchSpace, char value, int length)

public static int IndexOf<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength) where T : IEquatable<T>

public static int IndexOf<T>(ref T searchSpace, T value, int length) where T : IEquatable<T>

public static int IndexOfAny(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)

public static int IndexOfAny(ref byte searchSpace, byte value0, byte value1, int length)

public static int IndexOfAny(ref byte searchSpace, byte value0, byte value1, byte value2, int length)

public static int IndexOfAny<T>(ref T searchSpace, T value0, T value1, int length) where T : IEquatable<T>

public static int IndexOfAny<T>(ref T searchSpace, T value0, T value1, T value2, int length) where T : IEquatable<T>

public static int IndexOfAny<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength) where T : IEquatable<T>

public static bool IsReferenceOrContainsReferences<T>()

Determine if a type is eligible for storage in unmanaged memory. Portable equivalent of RuntimeHelpers.IsReferenceOrContainsReferences{T}()

public static int LastIndexOf(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)

public static int LastIndexOf(ref byte searchSpace, byte value, int length)

public static int LastIndexOf(ref char searchSpace, char value, int length)

public static int LastIndexOf<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength) where T : IEquatable<T>

public static int LastIndexOf<T>(ref T searchSpace, T value, int length) where T : IEquatable<T>

public static int LastIndexOfAny(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)

public static int LastIndexOfAny(ref byte searchSpace, byte value0, byte value1, int length)

public static int LastIndexOfAny(ref byte searchSpace, byte value0, byte value1, byte value2, int length)

public static int LastIndexOfAny<T>(ref T searchSpace, T value0, T value1, int length) where T : IEquatable<T>

public static int LastIndexOfAny<T>(ref T searchSpace, T value0, T value1, T value2, int length) where T : IEquatable<T>

public static int LastIndexOfAny<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength) where T : IEquatable<T>

public static int SequenceCompareTo(ref byte first, int firstLength, ref byte second, int secondLength)

public static int SequenceCompareTo(ref char first, int firstLength, ref char second, int secondLength)

public static int SequenceCompareTo<T>(ref T first, int firstLength, ref T second, int secondLength) where T : IComparable<T>

public static bool SequenceEqual(ref byte first, ref byte second, NUInt length)

public static bool SequenceEqual<T>(ref T first, ref T second, int length) where T : IEquatable<T>