一款简单易用的基础网络通讯组件库。

Metadata 类

元数据键值对。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.1.4.7+7f7e1f78093c99347956e09330d5d7aca1d2bdf2
C#
public sealed class Metadata : IEnumerable<KeyValuePair<string, string>>, 
	IEnumerable, IPackage
Inheritance
Object    Metadata
Implements
IEnumerableKeyValuePairString, String, IEnumerable, IPackage

构造函数

Metadata初始化 Metadata 类的一个新实例

属性

Count 获取元数据集合中唯一键的数量。
Item 获取或设置指定键的值。若值的 UTF-8 编码长度超过 MaxValueByteLength,则自动拆分存储。
Keys 获取元数据集合中所有唯一键的集合。
Values 获取元数据集合中所有合并值的集合,顺序与 Keys 对应。

方法

Add 向元数据集合添加一个键值对。如果键已经存在,则覆盖其值。若值的 UTF-8 编码长度超过 MaxValueByteLength,则自动拆分为多个条目存储。
Clear 清空元数据集合中的所有键值对。
ContainsKey 判断元数据集合中是否包含指定的键。
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
GetEnumeratorReturns an enumerator that iterates through the collection.
GetHashCodeServes as the default hash function.
(继承自 Object。)
GetTypeGets the Type of the current instance.
(继承自 Object。)
PackageTWriter 打包。

重写的话,约定基类方法必须先执行

Remove 从元数据集合中移除指定键的所有键值对条目。
ToStringReturns a string that represents the current object.
(继承自 Object。)
TryGetValue 尝试获取指定键对应的合并值。
UnpackageTReader 解包。

重写的话,约定基类方法必须先执行

扩展方法

ForEachKeyValuePairString, String 循环遍历每个元素,执行Action动作
(由 CollectionsExtension 定义。)
ForEachAsyncKeyValuePairString, String 循环遍历每个元素,执行异步动作
(由 CollectionsExtension 定义。)
GetSafeEnumeratorKeyValuePairString, String 获取安全的枚举器。
(由 SystemExtension 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

显式接口实现

IEnumerableGetEnumeratorReturns an enumerator that iterates through a collection.

参见