Skip to content

MondoCore/MondoCore.Collections

Repository files navigation

MondoCore.Collections

A set of collections and collection related extensions

Table of Contents

Extensions

Object Extensions


IDictionary<string, object> ToDictionary(this object obj)

Converts a POCO, anonymous object or a different kind of dictionary into a string/object dictionary


IDictionary<string, string> ToStringDictionary(this object obj)

Converts a POCO, anonymous object or a different kind of dictionary into a string/string dictionary


IReadOnlyDictionary<string, object> ToReadOnlyDictionary(this object obj)

Converts a POCO, anonymous object or a different kind of dictionary into a string/object readonly dictionary


IReadOnlyDictionary<string, string> ToReadOnlyStringDictionary(this object obj)

Converts a POCO, anonymous object or a different kind of dictionary into a string/string readonly dictionary


IEnumerable<(string Name, object Value)> GetProperties(this object obj)

Retrieves the properties and their values from a POCO or anonymous object

Dictionary Extensions


IDictionary<K, V>? Append<K, V>(this IDictionary<K, V> dict1, IDictionary<K, V>? dict2)

Adds all the keyvalue pairs from the second dictionary into the first (the first dictionary will be returned)


IDictionary<K, V>? Append<K, V>(this IDictionary<K, V> dict1, IReadOnlyDictionary<K, V>? dict2)

Adds all the keyvalue pairs from the second dictionary into the first (the first dictionary will be returned)


IDictionary<string, string>? AppendStrings(this IDictionary<string, string> dict1, IReadOnlyDictionary<string, object>? dict2, bool childrenAsJson = false)

Adds all the keyvalue pairs from the second dictionary into the first as strings. If the value being added is an object then it will be either added as serialized json or dotted values (e.g. Address.ZipCode)


IDictionary<K, V> Merge<K, V>(this IDictionary<K, V> dict1, IDictionary<K, V> dict2)

Adds all the keyvalue pairs from the second dictionary into the first (or returns the second dictionary if the first is empty)

Collections


class ConcurrentList

An implementation of IList that is thread-safe


class ConcurrentKeyedQueue

A thread safe queue that can also be accessed via a key (like a dictionary)

About

A set of collections and collection related extensions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages