System.ReadOnlySpanExtensions.Slice C# (CSharp) Method

Slice() private method

private Slice ( this text, int start ) : ReadOnlySpan
text this
start int
return ReadOnlySpan
        public static ReadOnlySpan<char> Slice(this string text, int start)
        {
            if (text == null)
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
            int textLength = text.Length;
            if ((uint)start > (uint)textLength)
                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start);

            unsafe
            {
                byte* byteOffset = ((byte*)StringAdjustment) + (uint)(start * sizeof(char));
                return new ReadOnlySpan<char>(Unsafe.As<Pinnable<char>>(text), (IntPtr)byteOffset, textLength - start);
            }
        }

Same methods

ReadOnlySpanExtensions::Slice ( this text ) : ReadOnlySpan
ReadOnlySpanExtensions::Slice ( this text, int start, int length ) : ReadOnlySpan
ReadOnlySpanExtensions