ArrayList.Contains(Object) メソッド
定義
public:
virtual bool Contains(System::Object ^ item);
public virtual bool Contains (object item);
public virtual bool Contains (object? item);
abstract member Contains : obj -> bool
override this.Contains : obj -> bool
Public Overridable Function Contains (item As Object) As Boolean
パラメーター
- item
- Object
ArrayList 内で検索される Object。The Object to locate in the ArrayList. 値として null
を指定できます。The value can be null
.
戻り値
true
が item
に存在する場合は ArrayList。それ以外の場合は false
。true
if item
is found in the ArrayList; otherwise, false
.
実装
注釈
このメソッドは、線形検索を実行します。したがって、このメソッドは O(n)
操作です。ここで、 n
は Count です。This method performs a linear search; therefore, this method is an O(n)
operation, where n
is Count.
このメソッドは、を呼び出すことによって等価性を判断し Object.Equals ます。This method determines equality by calling Object.Equals.
.NET Framework 2.0 以降では、このメソッドは、コレクションのオブジェクトとメソッドを使用して、 Equals CompareTo item
項目が存在するかどうかを判断します。Starting with the .NET Framework 2.0, this method uses the collection's objects' Equals and CompareTo methods on item
to determine whether item exists. 以前のバージョンの .NET Framework では、この決定は、 Equals CompareTo コレクション内のオブジェクトのパラメーターのメソッドとメソッドを使用して行われていま item
した。In the earlier versions of the .NET Framework, this determination was made by using the Equals and CompareTo methods of the item
parameter on the objects in the collection.