/// <summary>
        /// Reports the zero-based index of the last occurrence of the specified <paramref name="value"/> in the current <paramref name="span"/>.
        /// <param name="span">The source span.</param>
        /// <param name="value">The value to seek within the source span.</param>
        /// <param name="comparisonType">One of the enumeration values that determines how the <paramref name="span"/> and <paramref name="value"/> are compared.</param>
        /// </summary>
        public static int LastIndexOf(this ReadOnlySpan <char> span, ReadOnlySpan <char> value, StringComparison comparisonType)
        {
            string.CheckStringComparison(comparisonType);

            if (comparisonType == StringComparison.Ordinal)
            {
                return(SpanHelpers.LastIndexOf(
                           ref MemoryMarshal.GetReference(span),
                           span.Length,
                           ref MemoryMarshal.GetReference(value),
                           value.Length));
            }

            switch (comparisonType)
            {
            case StringComparison.CurrentCulture:
            case StringComparison.CurrentCultureIgnoreCase:
                return(CultureInfo.CurrentCulture.CompareInfo.LastIndexOf(span, value, string.GetCaseCompareOfComparisonCulture(comparisonType)));

            case StringComparison.InvariantCulture:
            case StringComparison.InvariantCultureIgnoreCase:
                return(CompareInfo.Invariant.LastIndexOf(span, value, string.GetCaseCompareOfComparisonCulture(comparisonType)));

            default:
                Debug.Assert(comparisonType == StringComparison.OrdinalIgnoreCase);
                return(Ordinal.LastIndexOfOrdinalIgnoreCase(span, value));
            }
        }