NameObjectCollectionBase.KeysCollection NameObjectCollectionBase.KeysCollection NameObjectCollectionBase.KeysCollection NameObjectCollectionBase.KeysCollection Class

定義

表示集合索引鍵 String 的集合。Represents a collection of the String keys of a collection.

public: ref class NameObjectCollectionBase::KeysCollection : System::Collections::ICollection
[System.Serializable]
public class NameObjectCollectionBase.KeysCollection : System.Collections.ICollection
type NameObjectCollectionBase.KeysCollection = class
    interface ICollection
    interface IEnumerable
Public Class NameObjectCollectionBase.KeysCollection
Implements ICollection
繼承
NameObjectCollectionBase.KeysCollectionNameObjectCollectionBase.KeysCollectionNameObjectCollectionBase.KeysCollectionNameObjectCollectionBase.KeysCollection
屬性
實作

屬性

Count Count Count Count

取得 NameObjectCollectionBase.KeysCollection 中的索引鍵數目。Gets the number of keys in the NameObjectCollectionBase.KeysCollection.

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

取得在集合的指定索引處的項目。Gets the entry at the specified index of the collection.

方法

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

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

(Inherited from Object)
Get(Int32) Get(Int32) Get(Int32) Get(Int32)

取得在集合的指定索引處的索引鍵。Gets the key at the specified index of the collection.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

傳回在 NameObjectCollectionBase.KeysCollection 中逐一查看的列舉值。Returns an enumerator that iterates through the NameObjectCollectionBase.KeysCollection.

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)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

明確介面實作

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

從目標陣列的指定索引開始,將整個 NameObjectCollectionBase.KeysCollection 複製到相容的一維 ArrayCopies the entire NameObjectCollectionBase.KeysCollection to a compatible one-dimensional Array, starting at the specified index of the target array.

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

取得值,這個值表示對 NameObjectCollectionBase.KeysCollection 的存取是否同步 (安全執行緒)。Gets a value indicating whether access to the NameObjectCollectionBase.KeysCollection is synchronized (thread safe).

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

取得可用以同步存取 NameObjectCollectionBase.KeysCollection 的物件。Gets an object that can be used to synchronize access to the NameObjectCollectionBase.KeysCollection.

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.

適用於

執行緒安全性

公用靜態 (Shared Visual Basic 中) 的這種類型的成員都是安全執行緒。Public static (Shared in Visual Basic) members of this type are thread safe. 不保證任何執行個體成員是安全執行緒。Any instance members are not guaranteed to be thread safe.

此實作不提供同步處理 (安全執行緒) 包裝函式NameObjectCollectionBase.KeysCollection,但是在衍生的類別可以建立他們自己的同步處理的版本NameObjectCollectionBase.KeysCollection使用SyncRoot屬性。This implementation does not provide a synchronized (thread safe) wrapper for a NameObjectCollectionBase.KeysCollection, but derived classes can create their own synchronized versions of the NameObjectCollectionBase.KeysCollection using the SyncRoot property.

透過集合進行列舉在本質上並非安全執行緒程序。Enumerating through a collection is intrinsically not a thread-safe procedure. 即使集合經過同步化,其他的執行緒仍可修改該集合,使列舉值擲回例外狀況。Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. 若要保證列舉過程的執行緒安全,您可以在整個列舉過程中鎖定集合,或攔截由其他執行緒的變更所造成的例外狀況。To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.