ListBox.SelectedObjectCollection ListBox.SelectedObjectCollection ListBox.SelectedObjectCollection ListBox.SelectedObjectCollection Class


表示 ListBox 中所選項目的集合。Represents the collection of selected items in the ListBox.

public: ref class ListBox::SelectedObjectCollection : System::Collections::IList
public class ListBox.SelectedObjectCollection : System.Collections.IList
type ListBox.SelectedObjectCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class ListBox.SelectedObjectCollection
Implements IList


ListBox.SelectedObjectCollection類別會儲存在選取的項目ListBoxThe ListBox.SelectedObjectCollection class stores the selected items in the ListBox. 項目儲存在ListBox.SelectedObjectCollection內含的項目ListBox.ObjectCollection類別。The items stored in the ListBox.SelectedObjectCollection are items contained within the ListBox.ObjectCollection class. ListBox.ObjectCollection類別會儲存所有項目顯示在ListBoxThe ListBox.ObjectCollection class stores all items displayed in the ListBox.

下表會如何的範例ListBox.ObjectCollection儲存的項目ListBox以及其在範例中的選取項目狀態ListBoxThe following table is an example of how the ListBox.ObjectCollection stores the items of the ListBox as well as their selection states within an example ListBox.

索引Index 項目Item 在清單方塊中的選取狀態Selection state within the ListBox
00 object1object1 未選取Unselected
11 object2object2 已選取Selected
22 object3object3 未選取Unselected
33 object4object4 已選取Selected
44 object5object5 已選取Selected

根據ListBox.ObjectCollection如上表所示下, 表示範如何ListBox.SelectedObjectCollection會出現。Based on the ListBox.ObjectCollection demonstrated in the previous table, the following table demonstrates how the ListBox.SelectedObjectCollection would appear.

索引Index 選取的項目從 ObjectCollectionSelected item from ObjectCollection
00 object2object2
11 object4object4
22 object5object5

您可以使用這個類別的方法與屬性來執行各種工作的集合。You can use the properties and methods of this class to perform a variety of tasks with the collection. Contains方法可讓您判斷是否將項目從ListBox.ObjectCollection類別是隸屬ListBox.SelectedObjectCollectionThe Contains method enables you to determine whether an item from the ListBox.ObjectCollection class is a member of the ListBox.SelectedObjectCollection. 一旦您知道項目位於集合中,您可以使用IndexOf方法,以判斷在特定的項目內ListBox.ObjectCollectionforListBox便會儲存在ListBox.SelectedObjectCollectionOnce you know that the item is located within the collection, you can use the IndexOf method to determine where a specific item within the ListBox.ObjectCollection for the ListBox is stored within the ListBox.SelectedObjectCollection.


ListBox.SelectedObjectCollection(ListBox) ListBox.SelectedObjectCollection(ListBox) ListBox.SelectedObjectCollection(ListBox) ListBox.SelectedObjectCollection(ListBox)

初始化 ListBox.SelectedObjectCollection 類別的新執行個體。Initializes a new instance of the ListBox.SelectedObjectCollection class.


Count Count Count Count

取得集合中的項目數目。Gets the number of items in the collection.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

取得值,表示集合是否為唯讀。Gets a value indicating whether the collection is read-only.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

取得集合中位於指定索引處的項目。Gets the item at the specified index within the collection.


Add(Object) Add(Object) Add(Object) Add(Object)

將項目加入 ListBox 的選取項目清單中。Adds an item to the list of selected items for a ListBox.

Clear() Clear() Clear() Clear()

從選取項目的集合中移除所有項目。Removes all items from the collection of selected items.

Contains(Object) Contains(Object) Contains(Object) Contains(Object)

判斷指定的項目是否位於集合中。Determines whether the specified item is located within the collection.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

將整個集合複製到現有陣列中的指定位置。Copies the entire collection into an existing array at a specified location within the array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

傳回列舉值,其可用來在選取項目集合中重複。Returns an enumerator that can be used to iterate through the selected item collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
IndexOf(Object) IndexOf(Object) IndexOf(Object) IndexOf(Object)

傳回指定項目集合中的索引。Returns the index within the collection of the specified item.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(Object) Remove(Object) Remove(Object) Remove(Object)

從選取項目的集合中移除指定的物件。Removes the specified object from the collection of selected items.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)


ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

如需這個成員的說明,請參閱 IsSynchronizedFor a description of this member, see IsSynchronized.

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

如需這個成員的說明,請參閱 SyncRootFor a description of this member, see SyncRoot.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

如需這個成員的說明,請參閱 Add(Object)For a description of this member, see Add(Object).

IList.Clear() IList.Clear() IList.Clear() IList.Clear()

如需這個成員的說明,請參閱 Clear()For a description of this member, see Clear().

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

如需這個成員的說明,請參閱 Insert(Int32, Object)For a description of this member, see Insert(Int32, Object).

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

如需這個成員的說明,請參閱 IsFixedSizeFor a description of this member, see IsFixedSize.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

如需這個成員的說明,請參閱 Remove(Object)For a description of this member, see Remove(Object).

IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32) IList.RemoveAt(Int32)

如需這個成員的說明,請參閱 RemoveAt(Int32)For a description of this member, see RemoveAt(Int32).

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

將轉換IEnumerableIQueryableConverts an IEnumerable to an IQueryable.