Show / Hide Table of Contents

Class IListExtensions

Contains IList extension methods.

Inheritance
System.Object
IListExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Microsoft.GNS.Utilities.Extensions
Assembly: Gns.Utilities.dll
Syntax
public static class IListExtensions

Methods

View Source

FirstIndexOf<T>(IList<T>, T, IEqualityComparer<T>)

Finds the first index of a collection that matches based on an equality comparer.

Declaration
public static int FirstIndexOf<T>(this IList<T> enumerable, T item, IEqualityComparer<T> comparer)
Parameters
Type Name Description
System.Collections.Generic.IList<T> enumerable

The collection to check for an index.

T item

The item to find.

System.Collections.Generic.IEqualityComparer<T> comparer

The equality comparer that determines if the item matches.

Returns
Type Description
System.Int32

The first index of the item, otherwise -1.

Type Parameters
Name Description
T

The type of the collection

View Source

FirstIndexOf<T>(IList<T>, Func<T, Boolean>)

Finds the first index of a collection that matches a predicate.

Declaration
public static int FirstIndexOf<T>(this IList<T> enumerable, Func<T, bool> predicate)
Parameters
Type Name Description
System.Collections.Generic.IList<T> enumerable

The collection to check for an index.

System.Func<T, System.Boolean> predicate

The function to check each element for a condition

Returns
Type Description
System.Int32

The first index that validates the predicate, otherwise -1.

Type Parameters
Name Description
T

The type of the collection

  • View Source
In This Article
Back to top Generated by DocFX