System.Collections.Generic.List<T>.AsReadOnly Method
Returns a read-only wrapper to the current List.

Syntax

public System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly ()

Returns

A read-only wrapper for the current List.

Remarks

To prevent any modifications to a list, expose it only through this wrapper.

A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes.

Requirements

Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0