Skip to content

DictionaryExtensions Class ​

Definition ​

Extensions for the Dictionary class object

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

Methods ​

NameDescription
void AddOrAppend(Dictionary<string, string> input, string key, string value, bool newLine = null)Adds key/value pair or updates existing key/value with additional data
void CamelCaseKeys(IDictionary<string, object> source)Convert Dictionary keys to CamelCase
bool CompareDictionary(IReadOnlyDictionary<TKey, TValue> input, IReadOnlyDictionary<TKey, TValue> to)Basic comparision of two Dictionary objects keys and values, it is recommended to implement IEquatable if calling on class values
bool DictionaryEquals(IReadOnlyDictionary<TKey, TValue> input, IReadOnlyDictionary<TKey, TValue> to)Basic comparision of two Dictionary objects keys and values, it is recommended to implement IEquatable if calling on class values
Dictionary<TKey, TValue> Differences(IReadOnlyDictionary<TKey, TValue> source, IReadOnlyDictionary<TKey, TValue> compareTo)Compares to Dictionary objects for differences
void ForEach(IDictionary<TKey, TValue> input, Action<KeyValuePair<TKey, TValue>> action)Implement ForEach style operation on IDictionary objects
KeyValuePair<TKey, TValue> Random(IDictionary<TKey, TValue> source)Returns a random KeyValuePair from a Dictionary object
TKey RandomKey(IDictionary<TKey, TValue> source)Returns a random Key from a Dictionary
TValue RandomValue(IDictionary<TKey, TValue> source)Returns a random Value from a Dictionary
void RemoveNulls(IDictionary<TKey, TValue> source, bool removeEmptyString = null)Removes keys from IDictionary where the Value is null
Dictionary<TKey, TValue> TakeAndRemove(IDictionary<TKey, TValue> source, int count)Returns the number of items in Count and removes them from the source dictionary
object ToObject(IDictionary<string, object> dict)Returns input dictionary as an ExpandoObject