Provides the abstract (MustInherit in Visual Basic) base class for a strongly typed read-only collection.
For a list of all members of this type, see ReadOnlyCollectionBase Members.
System.Object
System.Collections.ReadOnlyCollectionBase
Derived classes
[Visual Basic] <Serializable> MustInherit Public Class ReadOnlyCollectionBase Implements ICollection, IEnumerable [C#] [Serializable] public abstract class ReadOnlyCollectionBase : ICollection, IEnumerable [C++] [Serializable] public __gc __abstract class ReadOnlyCollectionBase : public ICollection, IEnumerable [JScript] public Serializable abstract class ReadOnlyCollectionBase implements ICollection, IEnumerable
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
This implementation does not provide a synchronized (thread-safe) wrapper for a ReadOnlyCollectionBase, but derived classes can create their own synchronized versions of the ReadOnlyCollectionBase using the SyncRoot property.
Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads could 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.
A ReadOnlyCollectionBase instance is always read-only. See CollectionBase for a modifiable version of this class.
Notes to Implementers:
This base class is provided to make it easier for implementers to create a strongly typed read-only custom collection. Implementers should extend this base class instead of creating their own. Members of this base class are protected and are intended to be used through a derived class only.
This class makes the underlying collection available through the InnerList property, which is intended for use only by classes that are derived directly from ReadOnlyCollectionBase. The derived class must ensure that its own users cannot modify the underlying collection.
Namespace: System.Collections
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Mscorlib (in Mscorlib.dll)
ReadOnlyCollectionBase Members | System.Collections Namespace | System.Collections.ArrayList | CollectionBase