CollectionExtensions.AsReadOnly Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Överlagringar
| Name | Description |
|---|---|
| AsReadOnly<T>(IList<T>) |
Returnerar en skrivskyddad ReadOnlyCollection<T> omslutning för den angivna listan. |
| AsReadOnly<T>(ISet<T>) |
Returnerar en skrivskyddad ReadOnlySet<T> omslutning för den angivna uppsättningen. |
| AsReadOnly<TKey,TValue>(IDictionary<TKey,TValue>) |
Returnerar en skrivskyddad ReadOnlyDictionary<TKey,TValue> omslutning för den aktuella ordlistan. |
AsReadOnly<T>(IList<T>)
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
Returnerar en skrivskyddad ReadOnlyCollection<T> omslutning för den angivna listan.
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)
Typparametrar
- T
Typ av element i samlingen.
Parametrar
- list
- IList<T>
Listan som ska omslutas.
Returer
Ett objekt som fungerar som en skrivskyddad omslutning runt den aktuella IList<T>.
Undantag
list är null.
Gäller för
AsReadOnly<T>(ISet<T>)
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
Returnerar en skrivskyddad ReadOnlySet<T> omslutning för den angivna uppsättningen.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Collections::ObjectModel::ReadOnlySet<T> ^ AsReadOnly(System::Collections::Generic::ISet<T> ^ set);
public static System.Collections.ObjectModel.ReadOnlySet<T> AsReadOnly<T>(this System.Collections.Generic.ISet<T> set);
static member AsReadOnly : System.Collections.Generic.ISet<'T> -> System.Collections.ObjectModel.ReadOnlySet<'T>
<Extension()>
Public Function AsReadOnly(Of T) (set As ISet(Of T)) As ReadOnlySet(Of T)
Typparametrar
- T
Typ av element i uppsättningen.
Parametrar
- set
- ISet<T>
Uppsättningen som ska omslutas.
Returer
Ett objekt som fungerar som en skrivskyddad omslutning runt den aktuella ISet<T>.
Undantag
set är null.
Gäller för
AsReadOnly<TKey,TValue>(IDictionary<TKey,TValue>)
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
- Källa:
- CollectionExtensions.cs
Returnerar en skrivskyddad ReadOnlyDictionary<TKey,TValue> omslutning för den aktuella ordlistan.
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)
Typparametrar
- TKey
Typ av nycklar i ordlistan.
- TValue
Typ av värden i ordlistan.
Parametrar
- dictionary
- IDictionary<TKey,TValue>
Ordlistan som ska omslutas.
Returer
Ett objekt som fungerar som en skrivskyddad omslutning runt den aktuella IDictionary<TKey,TValue>.
Undantag
dictionary är null.