CollectionExtensions.AsReadOnly Método

Definição

Sobrecargas

AsReadOnly<T>(IList<T>)

Retorna um wrapper somente ReadOnlyCollection<T> leitura para a lista especificada.

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

Retorna um wrapper somente ReadOnlyDictionary<TKey,TValue> leitura para o dicionário atual.

AsReadOnly<T>(IList<T>)

Retorna um wrapper somente ReadOnlyCollection<T> leitura para a 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

O tipo dos elementos na coleção.

Parâmetros

list
IList<T>

A lista a ser encapsulada.

Retornos

Um objeto que atua como um wrapper somente leitura em torno do IList<T> atual.

Exceções

list é null.

Aplica-se a

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

Retorna um wrapper somente ReadOnlyDictionary<TKey,TValue> leitura para o dicionário atual.

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

O tipo de chaves no dicionário.

TValue

O tipo de valores no dicionário.

Parâmetros

dictionary
IDictionary<TKey,TValue>

O dicionário a ser encapsulado.

Retornos

Um objeto que atua como um wrapper somente leitura em torno do IDictionary<TKey,TValue> atual.

Exceções

dictionary é null.

Aplica-se a