System.Generics.Collections.TArray.Contains
Delphi
class function Contains<T>(const Values: array of T; const Item: T): Boolean; overload; static;
class function Contains<T>(const Values: array of T; const Item: T;
const Comparer: IComparer<T>): Boolean; overload; static;
C++
template<typename T> static bool __fastcall Contains(const T *Values, const System::NativeInt Values_High, const T Item)/* overload */;
template<typename T> static bool __fastcall Contains(const T *Values, const System::NativeInt Values_High, const T Item, const System::DelphiInterface<System::Generics::Defaults::IComparer__1<T> > Comparer)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Generics.Collections.pas System.Generics.Collections.hpp |
System.Generics.Collections | TArray |
Description
Tests whether an element is in an array or not. Contains returns True
if the element Value
is in the array, otherwise it returns False
.
Since the search for the element is linear, it is an O(n) operation for an array with n entries.
Note: Contains only indicates if the element is in the array or not, use IndexOf to get the index of the element.