Bewerken

Share via


NameObjectCollectionBase.KeysCollection Class

Definition

Represents a collection of the String keys of a collection.

public: ref class NameObjectCollectionBase::KeysCollection : System::Collections::ICollection
public class NameObjectCollectionBase.KeysCollection : System.Collections.ICollection
[System.Serializable]
public class NameObjectCollectionBase.KeysCollection : System.Collections.ICollection
type NameObjectCollectionBase.KeysCollection = class
    interface ICollection
    interface IEnumerable
[<System.Serializable>]
type NameObjectCollectionBase.KeysCollection = class
    interface ICollection
    interface IEnumerable
Public Class NameObjectCollectionBase.KeysCollection
Implements ICollection
Inheritance
NameObjectCollectionBase.KeysCollection
Attributes
Implements

Properties

Count

Gets the number of keys in the NameObjectCollectionBase.KeysCollection.

Item[Int32]

Gets the entry at the specified index of the collection.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Get(Int32)

Gets the key at the specified index of the collection.

GetEnumerator()

Returns an enumerator that iterates through the NameObjectCollectionBase.KeysCollection.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

Copies the entire NameObjectCollectionBase.KeysCollection to a compatible one-dimensional Array, starting at the specified index of the target array.

ICollection.IsSynchronized

Gets a value indicating whether access to the NameObjectCollectionBase.KeysCollection is synchronized (thread safe).

ICollection.SyncRoot

Gets an object that can be used to synchronize access to the NameObjectCollectionBase.KeysCollection.

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

Thread Safety

Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.