src/Silk.Extensions/CollectionExtensions.cs
/// <summary>Returns the index of an element contained in a list if it is found, otherwise returns -1.</summary>
Returns the index of an element contained in a list if it is found, otherwise returns -1.
Returns the index of an element contained in a list if it is found otherwise returns - 1 .
public static int IndexOf<T>(this IReadOnlyList<T> list, T element) 
        {
            for (var i = 0; i < list.Count; i++)
                if (list[i]?.Equals(element) ?? false)
                    return i;
            return -1;
        }
public static int IndexOf < T > ( this IReadOnlyList < T > list , T element ) { for ( var i = 0 ; i < list . Count ; i ++ ) if ( list [ i ] ? . Equals ( element ) ?? false ) return i ; return - 1 ; }
Returns the index of an element contained in a list if it is found, otherwise returns -1.
Returns the index of an element contained in a list if it is found otherwise returns - 1 .
// IList doesn't implement IndexOf for some reason
IReadOnlyList<T>
this
element
T