CollectionExtensions.AsReadOnly メソッド

定義

オーバーロード

AsReadOnly<T>(IList<T>)

指定したリストの読み取り専用 ReadOnlyCollection<T> ラッパーを返します。

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

現在のディクショナリの読み取り専用 ReadOnlyDictionary<TKey,TValue> ラッパーを返します。

AsReadOnly<T>(IList<T>)

指定したリストの読み取り専用 ReadOnlyCollection<T> ラッパーを返します。

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)

型パラメーター

T

コレクション内の要素の型。

パラメーター

list
IList<T>

ラップするリスト。

戻り値

現在の IList<T> をラップする読み取り専用のラッパーとして動作するオブジェクト。

例外

listnullです。

適用対象

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

現在のディクショナリの読み取り専用 ReadOnlyDictionary<TKey,TValue> ラッパーを返します。

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)

型パラメーター

TKey

ディクショナリ内のキーの型。

TValue

ディクショナリ内の値の型。

パラメーター

dictionary
IDictionary<TKey,TValue>

ラップするディクショナリ。

戻り値

現在の IDictionary<TKey,TValue> をラップする読み取り専用のラッパーとして動作するオブジェクト。

例外

dictionarynullです。

適用対象