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 屬性表示的基礎清單中尋找的 List。The Object to locate in the underlying list represented by the List property. 這個值可以是 null
。The value can be null
.
傳回
如果在 List 中找到 value
參數,則為 true
,否則為 false
。true
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.
基礎方法會執行線性搜尋;因此,平均執行時間與屬性的值成正比 Count 。The underlying method performs a linear search; therefore, the average execution time is proportional to the value of the Count property.
基礎方法會藉由呼叫方法來判斷是否相等 Equals 。The underlying method determines equality by calling the Equals method.