M_Cyjb_Collections_DictionaryUtil_AsReadOnly__2 - CYJB/Cyjb GitHub Wiki

DictionaryUtil.AsReadOnly(TKey, TValue) 方法

返回当前字典的只读包装。

Namespace: Cyjb.Collections
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public static IReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(
	this IDictionary<TKey, TValue> dict
)

参数

 

dict
Type: System.Collections.Generic.IDictionary(TKey, TValue)
要被包装的字典。

类型参数

 

TKey
字典中键的类型。
TValue
字典中值的类型。

返回值

Type: IReadOnlyDictionary(TKey, TValue)
当前字典的只读包装。

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型IDictionary(TKey, TValue)的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。

参见

Reference

DictionaryUtil 类
Cyjb.Collections 命名空间

⚠️ **GitHub.com Fallback** ⚠️