Method IndexOf
IndexOf<T>(ExSpan<T>, T)
Searches for the specified value and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T).
public static nint IndexOf<T>(this ExSpan<T> span, T value) where T : IEquatable<T>?
Parameters
spanExSpan<T>The span to search.
valueTThe value to search for.
Returns
Type Parameters
T
IndexOf<T>(ExSpan<T>, ReadOnlyExSpan<T>)
Searches for the specified sequence and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T).
public static nint IndexOf<T>(this ExSpan<T> span, ReadOnlyExSpan<T> value) where T : IEquatable<T>?
Parameters
spanExSpan<T>The span to search.
valueReadOnlyExSpan<T>The sequence to search for.
Returns
Type Parameters
T
IndexOf<T>(ReadOnlyExSpan<T>, T)
Searches for the specified value and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T).
public static nint IndexOf<T>(this ReadOnlyExSpan<T> span, T value) where T : IEquatable<T>?
Parameters
spanReadOnlyExSpan<T>The span to search.
valueTThe value to search for.
Returns
Type Parameters
T
IndexOf<T>(ReadOnlyExSpan<T>, T, IEqualityComparer<T>?)
Searches for the specified value and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T).
public static nint IndexOf<T>(this ReadOnlyExSpan<T> span, T value, IEqualityComparer<T>? comparer = null)
Parameters
spanReadOnlyExSpan<T>The span to search.
valueTThe value to search for.
comparerIEqualityComparer<T>The IEqualityComparer<T> implementation to use when comparing elements, or null to use the default IEqualityComparer<T> for the type of an element.
Returns
Type Parameters
T
IndexOf<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>)
Searches for the specified sequence and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T).
public static nint IndexOf<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> value) where T : IEquatable<T>?
Parameters
spanReadOnlyExSpan<T>The span to search.
valueReadOnlyExSpan<T>The sequence to search for.
Returns
Type Parameters
T
IndexOf<T>(ReadOnlyExSpan<T>, ReadOnlyExSpan<T>, IEqualityComparer<T>?)
Searches for the specified sequence and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T).
public static nint IndexOf<T>(this ReadOnlyExSpan<T> span, ReadOnlyExSpan<T> value, IEqualityComparer<T>? comparer = null)
Parameters
spanReadOnlyExSpan<T>The span to search.
valueReadOnlyExSpan<T>The sequence to search for.
comparerIEqualityComparer<T>The IEqualityComparer<T> implementation to use when comparing elements, or null to use the default IEqualityComparer<T> for the type of an element.
Returns
Type Parameters
T
IndexOf(ReadOnlyExSpan<char>, ReadOnlyExSpan<char>, StringComparison)
Reports the zero-based index of the first occurrence of the specified value in the current span.
public static nint IndexOf(this ReadOnlyExSpan<char> span, ReadOnlyExSpan<char> value, StringComparison comparisonType)
Parameters
spanReadOnlyExSpan<char>The source span.
valueReadOnlyExSpan<char>The value to seek within the source span.
comparisonTypeStringComparisonOne of the enumeration values that determines how the
spanandvalueare compared.
Returns
Exceptions
- ExSpanTooLongException
Throws an exception if the length is out of the range of Int32.