KeyValue pair data related extensions API.
KeyValuePairExtensions
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| Popout | 1 | 从目标字典中按照给定的键名称获取值然后删除给定的键名称对应的数据 |
| ToLower | 1 | transform the hash key string to lower case characters |
| ToUpper | 1 | transform the hash key string to upper case characters |
| ComputeIfAbsent | 1 | 这个拓展函数主要是针对值得构建比较耗时的操作,主要应用于数据缓存场景 |
| Tuple | 1 | Create a tuple for two elements |
| Tsv | 1 | 将目标键值对集合保存为一个Tsv文件 |
| AsTable | 1 | tuple set to dictionary table |
| KeyItem | 1 | Item selector by directly text equals match. |
| Takes | 2 | 按照给定的键名列表keys将字典之中的对应的元素按照键名的顺序取出来 |
| Subset | 1 | 根据所给定的一个主键列表批量化取出目标字典之中的一部分数据构成一个新的字典子集对象 函数会根据KeyValuePairExtensions.Keys())参数来做排序 |
| RemoveAndGet | 1 | Removes the target key in the dictionary table, and then gets the removed value. |
| IteratesAll | 1 | Iterates all of the values in the source collection data. |
| GroupByKey | 1 | Groups source by IKeyedEntity.Key |
| Values | 1 | Retrieve all items' value data. |
| Values | 1 | get values from the key-value paires |
| Keys | 1 | gets all IKeyedEntity.Key values. |
| Keys | 1 | get group keys |
| GetByKey | 1 | Get a specific item value from the target collction data using its UniqueID property, (请注意,请尽量不要使用本方法,因为这个方法的效率有些低,对于获取INamedValue类型的集合之中的某一个对象,请尽量先转换为字典对象,在使用该字典对象进行查找以提高代码效率,使用本… |
| ContainsKey | 2 | Dictionary object contains the specific NamedValue.Name? |
| DictionaryData | 1 | Converts the interface object into a Dictionary object. |
| EnumParser | 1 | Creates the dictionary for string converts to enum value. |
| NamedValues | 1 | Convert the dictionary table as the NamedValue collection. |
| NameValueCollection | 1 | 获取得到的集合对象是一个安全的集合对象,不存在的键名会直接返回空值 |
| SortByKey | 1 | 按照键名对字典进行重新排序 |
| ContainsKey | 1 | Determines whether the KeyValuePairExtensions.NameValueCollection()) contains the specified key. |
| ParserDictionary | 1 | 请注意,这里的类型约束只允许枚举类型 |
| HaveData | 1 | Data exists and not nothing |
| ToDictionary | 2 | |
| ToDictionary | 1 | Creates a Dictionary2 from an IEnumerable1 according to a specified key selector function. |
| FlatTable | 1 | 将命名变量对象进行降维,名字作为键名,值作为键值,生成字典 |
| Add | 1 | Adds an object to the end of the List1. |
| ReverseMaps | 1 | 使用这个函数应该要确保value是没有重复的,假若removeDuplicated是默认值的话. |
| Selects | 1 | 一次性地使用一个键名的集合从字典之中选出一组数据 |
| Size | 1 | get length of the value array |
| Values | 1 | |
| Popout | 1 | |
| TupleTable | 1 | |
| ToLower | 1 | |
| ToUpper | 1 | |
| ComputeIfAbsent | 1 | |
| GetValueOrDefault | 1 | |
| Selects | 2 | |
| AsEnumerable | 1 | |
| SetOfKeyValuePairs | 1 | |
| DescendingMap | 1 | |
| Tuple | 1 | |
| AsTable | 1 | |
| KeyItem | 1 | |
| Takes | 2 | |
| Subset | 2 | |
| XMLModel | 1 | |
| EnumerateTuples | 1 | |
| AsNamedValueTuples | 1 | |
| RemoveAndGet | 1 | |
| IteratesAll | 1 | |
| Add | 1 | |
| GroupByKey | 1 | |
| Keys | 2 | |
| GetByKey | 1 | |
| DictionaryData | 1 | |
| EnumParser | 1 | |
| NamedValues | 1 | |
| IterateNameValues | 1 | |
| IterateNameCollections | 1 | |
| SortByValue | 1 | |
| SortByKey | 1 | |
| Join | 1 | |
| ParserDictionary | 1 | |
| HaveData | 1 | |
| FlatTable | 1 | |
| ReverseMaps | 1 | |
| Select | 1 | |
| Size | 1 |
03 Members
Dictionary(Of ``0, ``1), ``0)从目标字典中按照给定的键名称获取值然后删除给定的键名称对应的数据
| Name | Description |
|---|---|
K | |
V |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of ``0, ``1) | - |
key | ``0 | - |
returns nothing if the given key is not existed inside the dictionary
Dictionary(Of String, ``0))transform the hash key string to lower case characters
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of String, ``0) | - |
Dictionary(Of String, ``0))transform the hash key string to upper case characters
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of String, ``0) | - |
IDictionary(Of ``0, ``1), ``0, Func(Of ``0, ``1))这个拓展函数主要是针对值得构建比较耗时的操作,主要应用于数据缓存场景
thread safe: target table has been SyncLock at here
| Name | Description |
|---|---|
K | |
V |
| Name | Type | Description |
|---|---|---|
table | IDictionary(Of ``0, ``1) | - |
key | ``0 | - |
lazyValue | Func(Of ``0, ``1) | - |
``0, ``1)Create a tuple for two elements
| Name | Description |
|---|---|
T1 | |
T2 |
| Name | Type | Description |
|---|---|---|
a | ``0 | - |
b | ``1 | - |
将目标键值对集合保存为一个Tsv文件
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of String, String) | - |
saveTo$ | String | - |
encoding | Encodings | - |
IEnumerable(Of ValueTuple(Of ``0, ``1)))tuple set to dictionary table
| Name | Description |
|---|---|
K | |
V |
| Name | Type | Description |
|---|---|---|
tuples | IEnumerable(Of ValueTuple(Of ``0, ``1)) | - |
IEnumerable(Of ``0), String)Item selector by directly text equals match.
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of ``0) | - |
key | String | - |
nothing will be return if the key is not exists or source sequence is nothing
IEnumerable(Of ``0), String)Item selector by using regex expression.
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of ``0) | - |
pattern | String | The regular expression pattern. |
IDictionary(Of String, ``0), IEnumerable(Of String), ``0)按照给定的键名列表keys将字典之中的对应的元素按照键名的顺序取出来
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | IDictionary(Of String, ``0) | - |
keys | IEnumerable(Of String) | - |
default | ``0 | Use this as default value is key is not exists |
default value will be returned if the specific key is not exists in the given table
Dictionary(Of String, ``0), String(), Boolean)根据所给定的一个主键列表批量化取出目标字典之中的一部分数据构成一个新的字典子集对象 函数会根据KeyValuePairExtensions.Keys()参数来做排序
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of String, ``0) | - |
keys$ | String() | - |
Dictionary(Of ``0, ``1), ``0)Removes the target key in the dictionary table, and then gets the removed value. (删除字典之中的指定的键值对,然后返回被删除的数据值)
| Name | Description |
|---|---|
K | |
V |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of ``0, ``1) | - |
key | ``0 | - |
The value of the removed key
IEnumerable(Of NamedCollection(Of ``0)))Iterates all of the values in the source collection data.
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of NamedCollection(Of ``0)) | - |
IEnumerable(Of ``0))Groups source by IKeyedEntity.Key
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of ``0) | - |
IEnumerable(Of NamedValue(Of ``0)))Retrieve all items' value data.
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of NamedValue(Of ``0)) | - |
IEnumerable(Of KeyValuePair(Of ``0, ``1)))get values from the key-value paires
| Name | Description |
|---|---|
T | |
V | the tuple value type |
| Name | Type | Description |
|---|---|---|
src | IEnumerable(Of KeyValuePair(Of ``0, ``1)) | - |
IEnumerable(Of ``0), Boolean)gets all IKeyedEntity.Key values. (按照顺序得到输入的序列之中的IKeyedEntity.Key属性值)
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of ``0) | - |
distinct | Boolean | 是否还进行去重操作?默认不做去重 |
A collection list of the index key name values which is extract from the source, the label key orders keeps the same with the elements inside the input source sequence.
IEnumerable(Of IGrouping(Of ``0, ``1)))get group keys
| Name | Description |
|---|---|
K | |
V |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of IGrouping(Of ``0, ``1)) | - |
IEnumerable(Of ``0), String, StringComparison)Get a specific item value from the target collction data using its UniqueID property, (请注意,请尽量不要使用本方法,因为这个方法的效率有些低,对于获取INamedValue类型的集合之中的某一个对象,请尽量先转换为字典对象,在使用该字典对象进行查找以提高代码效率,使用本方法的优点是可以选择忽略uid参数之中的大小写,以及对集合之中的存在相同的Key的这种情况的容忍)
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of ``0) | - |
uid | String | - |
IgnoreCase | StringComparison | - |
Dictionary object contains the specific NamedValue.Name?
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of ``0) | - |
k | NamedValue(Of ``0) | - |
Dictionary(Of String, ``0), NamedValue(Of ``0))Dictionary object contains the specific NamedValue.Name?
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of String, ``0) | - |
k | NamedValue(Of ``0) | - |
IReadOnlyDictionary(Of ``0, ``1))Converts the interface object into a Dictionary object.
| Name | Description |
|---|---|
T | |
V |
| Name | Type | Description |
|---|---|---|
source | IReadOnlyDictionary(Of ``0, ``1) | - |
Boolean, Boolean)Creates the dictionary for string converts to enum value. (接受的泛型类型必须是枚举类型)
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
lcaseKey | Boolean | - |
usingDescription | Boolean | - |
Dictionary(Of String, ``0))Convert the dictionary table as the NamedValue collection. (将目标字典之中的键值对转换为被命名为的变量值)
如果需要调用Linq模式的方法,可以使用KeyValuePairExtensions.IterateNameValues()
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of String, ``0) | - |
IEnumerable(Of NamedValue(Of String)))获取得到的集合对象是一个安全的集合对象,不存在的键名会直接返回空值
| Name | Type | Description |
|---|---|---|
maps | IEnumerable(Of NamedValue(Of String)) | the duplicated keys in this tuple list can be existed |
the duplicated key can be existed
Dictionary(Of ``0, ``1), Boolean)按照键名对字典进行重新排序
| Name | Description |
|---|---|
V | |
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of ``0, ``1) | - |
desc | Boolean | 默认为从小到大的升序排序 |
NameValueCollection, String)Determines whether the KeyValuePairExtensions.NameValueCollection() contains the specified key.
| Name | Type | Description |
|---|---|---|
d | NameValueCollection | - |
key$ | String | The key to locate in the KeyValuePairExtensions.NameValueCollection() |
true if the System.Collections.Generic.Dictionary`2 contains an element with the specified key; otherwise, false.
请注意,这里的类型约束只允许枚举类型
| Name | Description |
|---|---|
T |
Dictionary(Of ``0, String), ``0)Data exists and not nothing
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
d | Dictionary(Of ``0, String) | - |
key | ``0 | - |
NameValueCollection, Boolean)| Name | Type | Description |
|---|---|---|
nc | NameValueCollection | - |
allStrings | Boolean | get all of the string values for each parameter name? if this parameter value is TRUE, then the value of the output dictionary will be a string array. |
IEnumerable(Of ``0), Boolean)Creates a Dictionary2 from an [IEnumerable](cref:T:System.Collections.Generic.IEnumerable%601)1 according to a specified key selector function.
20241125 NOTE: the generated dictionary is a sort dictionary, keys will be re-ordered!
| Name | Description |
|---|---|
T | Unique identifier provider IKeyedEntity.Key |
| Name | Type | Description |
|---|---|---|
source | IEnumerable(Of ``0) | - |
将命名变量对象进行降维,名字作为键名,值作为键值,生成字典
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
table | Dictionary(Of NamedValue(Of ``0)) | - |
Adds an object to the end of the List`1.
| Name | Description |
|---|---|
TKey | |
TValue |
| Name | Type | Description |
|---|---|---|
list | List(Of KeyValuePairObject(Of ``0, ``1)) | - |
key | ``0 | - |
value | ``1 | - |
Dictionary(Of ``0, ``1), Boolean)使用这个函数应该要确保value是没有重复的,假若removeDuplicated是默认值的话.
| Name | Description |
|---|---|
T | |
V |
| Name | Type | Description |
|---|---|---|
d | Dictionary(Of ``0, ``1) | - |
Dictionary(Of ``0, ``1), IEnumerable(Of ``0), Boolean)一次性地使用一个键名的集合从字典之中选出一组数据
| Name | Description |
|---|---|
T | |
V |
| Name | Type | Description |
|---|---|---|
d | Dictionary(Of ``0, ``1) | - |
keys | IEnumerable(Of ``0) | - |
skipNonExist | Boolean | - |
KeyValuePair(Of ``0, ``1()))get length of the value array
| Name | Description |
|---|---|
K | |
V |
| Name | Type | Description |
|---|---|---|
dict | KeyValuePair(Of ``0, ``1()) | - |
IEnumerable(Of SeqValue(Of T)))Dictionary(Of K, V), K)ValueTuple(Of String(), String()))Dictionary(Of String, T))Dictionary(Of String, T))IDictionary(Of K, V), K, Func(Of K, V))K, Dictionary(Of K, V), V)Dictionary(Of K, V), K())NameObjectCollectionBase+KeysCollection)IDictionary(Of TKey, TValue))IEnumerable(Of T))T1, T2)IEnumerable(Of ValueTuple(Of K, V)))IEnumerable(Of T), String)IEnumerable(Of T), String)Dictionary(Of String, T), String(), Boolean)Dictionary(Of K, V), Func(Of K, V, Boolean))IDictionary(Of String, T), IEnumerable(Of String), T)IEnumerable(Of NamedValue(Of String)))Dictionary(Of String, T))IEnumerable(Of KeyValuePair(Of String, T)))Dictionary(Of K, V), K)IEnumerable(Of NamedCollection(Of T)))IEnumerable(Of T))IEnumerable(Of T), Boolean)IEnumerable(Of IGrouping(Of K, V)))IEnumerable(Of T), String, StringComparison)IReadOnlyDictionary(Of T, V))Boolean, Boolean)IEnumerable(Of IDMap))Dictionary(Of String, T))Dictionary(Of String, T()))Dictionary(Of V, T), Boolean)Dictionary(Of V, T), Boolean)Dictionary(Of T, V), T, V)Dictionary(Of T, String), T)IEnumerable(Of KeyValuePair(Of K, V)), Func(Of K, V, KOut), Func(Of K, V, VOut))Dictionary(Of T, V), Boolean)Dictionary(Of T, V), IEnumerable(Of T), Boolean)IEnumerable(Of KeyValuePair(Of K, V)), Func(Of K, V, T))KeyValuePair(Of K, V()))