BindingSource.Contains(Object) 方法

定義

判斷某個物件是否為清單中的項目。Determines whether an object is an item in the list.

public:
 virtual bool Contains(System::Object ^ value);
public virtual bool Contains (object value);
abstract member Contains : obj -> bool
override this.Contains : obj -> bool
Public Overridable Function Contains (value As Object) As Boolean

參數

value
Object

要在 Object 屬性表示的基礎清單中尋找的 ListThe Object to locate in the underlying list represented by the List property. 這個值可以是 nullThe value can be null.

傳回

Boolean

如果在 List 中找到 value 參數,則為 true,否則為 falsetrue if the value parameter is found in the List; otherwise, false.

實作

備註

雖然執行相依于基礎清單的 Contains 方法,但通常會套用下列特性:Although the implementation is dependent on the underlying list's Contains method, typically the following characteristics apply:

  • List 搜尋從第一個元素開始,並在最後一個元素結束。List is searched starting at the first element and ending at the last element.

  • 基礎方法會執行線性搜尋;因此,平均執行時間與屬性的值成正比 CountThe underlying method performs a linear search; therefore, the average execution time is proportional to the value of the Count property.

  • 基礎方法會藉由呼叫方法來判斷是否相等 EqualsThe underlying method determines equality by calling the Equals method.

適用於

另請參閱