Show / Hide Table of Contents

Class List

Contains static extension methods for IList types.

Inheritance
System.Object
List
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public static class List : object

Methods

| Improve this Doc View Source

RemoveAll<T>(IList<T>, T)

Removes all occurences of an item in the list.

Declaration
public static void RemoveAll<T>(this IList<T> iList, T value)
Parameters
Type Name Description
IList<T> iList

The list to remove the values from.

T value

The value to remove all occurences of.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

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

Removes all occurences of an item in the list.

Declaration
public static void RemoveAll<T>(this IList<T> iList, T value, Func<T, T, bool> equate)
Parameters
Type Name Description
IList<T> iList

The list to remove the values from.

T value

The value to remove all occurences of.

Func<T, T, System.Boolean> equate

The delegate for performing equality checks.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

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

Removes all predicated values from an IList<T>.

Declaration
public static void RemoveAll<T>(this IList<T> iList, Func<T, bool> predicate)
Parameters
Type Name Description
IList<T> iList

The IList<T> to remove values from.

Func<T, System.Boolean> predicate

The predicate for selecting removals from the IList<T>.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

RemoveFirst<T>(IList<T>, T)

Removes the first occurence of an item in the list.

Declaration
public static void RemoveFirst<T>(this IList<T> iList, T value)
Parameters
Type Name Description
IList<T> iList

The list to remove the value from.

T value

The value to remove the first occurence of.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

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

Removes the first occurence of an item in the list.

Declaration
public static void RemoveFirst<T>(this IList<T> iList, T value, Func<T, T, bool> equate)
Parameters
Type Name Description
IList<T> iList

The list to remove the value from.

T value

The value to remove the first occurence of.

Func<T, T, System.Boolean> equate

The delegate for performing equality checks.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

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

Removes the first equality by object reference.

Declaration
public static void RemoveFirst<T>(this IList<T> iList, Func<T, bool> predicate)
Parameters
Type Name Description
IList<T> iList

The list to remove the value from.

Func<T, System.Boolean> predicate

The predicate to determine removal.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

TryRemoveFirst<T>(IList<T>, T)

Removes the first occurence of an item in the list or returns false.

Declaration
public static bool TryRemoveFirst<T>(this IList<T> iList, T value)
Parameters
Type Name Description
IList<T> iList

The list to remove the value from.

T value

The value to remove the first occurence of.

Returns
Type Description
System.Boolean

True if the item was found and removed; False if not.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

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

Removes the first occurence of an item in the list or returns false.

Declaration
public static bool TryRemoveFirst<T>(this IList<T> iList, T value, Func<T, T, bool> equate)
Parameters
Type Name Description
IList<T> iList

The list to remove the value from.

T value

The value to remove the first occurence of.

Func<T, T, System.Boolean> equate

The delegate for performing equality checks.

Returns
Type Description
System.Boolean

True if the item was found and removed; False if not.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

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

Tries to removes the first predicated value from an IList<T>.

Declaration
public static bool TryRemoveFirst<T>(this IList<T> iList, Func<T, bool> predicate)
Parameters
Type Name Description
IList<T> iList

The IList<T> to remove an element from.

Func<T, System.Boolean> predicate

The predicate for selecting the removal from the IList<T>.

Returns
Type Description
System.Boolean

True if the predicated element was found and removed. False if not.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

| Improve this Doc View Source

TryRemoveFirst<T>(IList<T>, Func<T, Boolean>, out Nullable<Exception>)

Tries to removes the first predicated value from an IList<T>.

Declaration
public static bool TryRemoveFirst<T>(this IList<T> iList, Func<T, bool> predicate, out Exception? exception)
Parameters
Type Name Description
IList<T> iList

The IList<T> to remove an element from.

Func<T, System.Boolean> predicate

The predicate for selecting the removal from the IList<T>.

System.Nullable<Exception> exception

The exception that occured if the removal failed.

Returns
Type Description
System.Boolean

True if the predicated element was found and removed. False if not.

Type Parameters
Name Description
T

The generic type of values inside the IList<T>.

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