{TOC}
| Namespace: | System.Linq |
| Assembly: | System.Core.dll |
| Extends: | IEnumerable<T> |
Back to
Standard Query Operator IndexEditIntroduction
The Contains operator checks whether a sequence contains a given element.
EditMethod Signatures
public static bool Contains<TSource>(
this IEnumerable<TSource> source,
TSource value)
//New in January CTP
public static bool Contains<TSource>(
this IEnumerable<TSource> source,
TSource value,
IEqualityComparer<TSource> comparer)EditExceptions
Throws an ArgumentNullException if
source is null.
EditPseudocode
If
source is null, throw ArgumentNullException.
If
comparer is null, make it EqualityComparer<TSource>.Default;
Iterate the source sequence
- if the element ==
value return true
return false if end of sequence and no match found.
EditCode Samples
TODO:Needs code sample.