CollectionExtensions.AsReadOnly Método

Definición

Sobrecargas

AsReadOnly<T>(IList<T>)

Devuelve un contenedor de solo ReadOnlyCollection<T> lectura para la lista especificada.

AsReadOnly<TKey,TValue>(IDictionary<TKey,TValue>)

Devuelve un contenedor de solo ReadOnlyDictionary<TKey,TValue> lectura para el diccionario actual.

AsReadOnly<T>(IList<T>)

Devuelve un contenedor de solo ReadOnlyCollection<T> lectura para la lista especificada.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::ObjectModel::ReadOnlyCollection<T> ^ AsReadOnly(System::Collections::Generic::IList<T> ^ list);
public static System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly<T> (this System.Collections.Generic.IList<T> list);
static member AsReadOnly : System.Collections.Generic.IList<'T> -> System.Collections.ObjectModel.ReadOnlyCollection<'T>
<Extension()>
Public Function AsReadOnly(Of T) (list As IList(Of T)) As ReadOnlyCollection(Of T)

Parámetros de tipo

T

Tipo de los elementos de la colección.

Parámetros

list
IList<T>

Lista que se va a incluir.

Devoluciones

Objeto que actúa como contenedor de solo lectura para la IList<T> actual.

Excepciones

list es null.

Se aplica a

AsReadOnly<TKey,TValue>(IDictionary<TKey,TValue>)

Devuelve un contenedor de solo ReadOnlyDictionary<TKey,TValue> lectura para el diccionario actual.

public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::ObjectModel::ReadOnlyDictionary<TKey, TValue> ^ AsReadOnly(System::Collections::Generic::IDictionary<TKey, TValue> ^ dictionary);
public static System.Collections.ObjectModel.ReadOnlyDictionary<TKey,TValue> AsReadOnly<TKey,TValue> (this System.Collections.Generic.IDictionary<TKey,TValue> dictionary);
static member AsReadOnly : System.Collections.Generic.IDictionary<'Key, 'Value> -> System.Collections.ObjectModel.ReadOnlyDictionary<'Key, 'Value>
<Extension()>
Public Function AsReadOnly(Of TKey, TValue) (dictionary As IDictionary(Of TKey, TValue)) As ReadOnlyDictionary(Of TKey, TValue)

Parámetros de tipo

TKey

Tipo de claves del diccionario.

TValue

Tipo de valores del diccionario.

Parámetros

dictionary
IDictionary<TKey,TValue>

Diccionario que se va a ajustar.

Devoluciones

Objeto que actúa como contenedor de solo lectura para la IDictionary<TKey,TValue> actual.

Excepciones

dictionary es null.

Se aplica a