Mono Class Library: System.Array Overview | Members

System.Array.AsReadOnly<T> Method

Returns a read-only System.Collections.Generic.IList<T> wrapper around the specified array. [Edit]

public static System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly<T> (T[] array)

Type Parameters

T
Documentation for this section has not yet been entered. [Edit]

Parameters

array
The array to wrap in a read-only IList<T> wrapper. [Edit]

Returns

A read-only IList<T> wrapper around the specified array. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionarray is null. [Edit]

Remarks

Note: To prevent any modifications to the array, expose the array only through this wrapper.

The returned IList<T> has the same enumeration order as the array it wraps.

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

[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0