Apq.Cfg.ICfgRoot.GetMany.md 8.6 KB

Apq.Cfg

Apq.Cfg.ICfgRoot

ICfgRoot.GetMany Method

Overloads
GetMany(IEnumerable<string>) 批量获取多个配置值,减少锁竞争
GetMany(IEnumerable<string>, Action<string,string>) 高性能批量获取:通过回调方式返回结果,零堆分配
GetMany<T>(IEnumerable<string>) 批量获取多个配置值并转换为指定类型
GetMany<T>(IEnumerable<string>, Action<string,T>) 高性能批量获取:通过回调方式返回结果并转换类型,零堆分配

ICfgRoot.GetMany(IEnumerable<string>) Method

批量获取多个配置值,减少锁竞争

System.Collections.Generic.IReadOnlyDictionary<string,string?> GetMany(System.Collections.Generic.IEnumerable<string> keys);

Parameters

keys System.Collections.Generic.IEnumerable<System.String>

要获取的键集合

Returns

System.Collections.Generic.IReadOnlyDictionary<System.String,System.String>
键值对字典

ICfgRoot.GetMany(IEnumerable<string>, Action<string,string>) Method

高性能批量获取:通过回调方式返回结果,零堆分配

void GetMany(System.Collections.Generic.IEnumerable<string> keys, System.Action<string,string?> onValue);

Parameters

keys System.Collections.Generic.IEnumerable<System.String>

要获取的键集合

onValue System.Action<System.String,System.String>

每个键值对的回调处理函数

Remarks

此方法避免了 Dictionary 分配开销,适合高频调用场景。 回调会按键的顺序依次调用。

ICfgRoot.GetMany<T>(IEnumerable<string>) Method

批量获取多个配置值并转换为指定类型

System.Collections.Generic.IReadOnlyDictionary<string,T?> GetMany<T>(System.Collections.Generic.IEnumerable<string> keys);

Type parameters

T

目标类型

Parameters

keys System.Collections.Generic.IEnumerable<System.String>

要获取的键集合

Returns

System.Collections.Generic.IReadOnlyDictionary<System.String,T>
键值对字典

ICfgRoot.GetMany<T>(IEnumerable<string>, Action<string,T>) Method

高性能批量获取:通过回调方式返回结果并转换类型,零堆分配

void GetMany<T>(System.Collections.Generic.IEnumerable<string> keys, System.Action<string,T?> onValue);

Type parameters

T

目标类型

Parameters

keys System.Collections.Generic.IEnumerable<System.String>

要获取的键集合

onValue System.Action<System.String,T>

每个键值对的回调处理函数

Remarks

此方法避免了 Dictionary 分配开销,适合高频调用场景。 回调会按键的顺序依次调用。