ArrayExtensions.Contains<T>

Extension Method in ArrayExtensions

Declaration

public static bool Contains<T>(this T[] array, T element)
    where T : IEquatable<T>

Description

Checks if the array contains the given element.

Type Parameters

TThe type of the array.

Parameters

arrayThe array to search in.
elementThe element to search for.

Returns

boolTrue if the array contains the element, false otherwise.

Overload

Declaration

public static bool Contains<T>(this T[] array, Predicate<T> predicate)

Description

Checks if the array contains an element that satisfies a predicate.

Type Parameters

TThe type of the array.

Parameters

arrayThe array to search in.
predicateThe predicate to use.

Returns

boolTrue if any element satisfies the predicate.