ICollectionExtensions

Extension methods for System.Collections.Generic.ICollection<T> that add readability-oriented collection queries.

Definition

Namespace: Paragon Assembly: Paragon.dll

public static class ICollectionExtensions

Remarks

This is a readability helper that avoids the double-negative pattern of !collection.Contains(item). It works with any ICollection<T> implementation including List<T>, HashSet<T>, arrays, and Dictionary<TKey, TValue>.Keys.

Methods

NotContains

Returns true if the collection does not contain the specified item. Syntactic inverse of ICollection<T>.Contains().

public static bool NotContains<T>(this ICollection<T> collection, T item)
Parameter
Type
Description

collection

ICollection<T>

The collection to search

item

T

The item to check for

Returns: true if the item is not in the collection; false if it is.

Examples

See Also

Last updated