Table of Contents

Class DictionaryExtensions

Namespace
OpenSettings.Extensions
Assembly
OpenSettings.dll

Provides extension methods for IDictionary<TKey, TValue> to simplify dictionary operations.

public static class DictionaryExtensions
Inheritance
DictionaryExtensions
Inherited Members

Methods

GetOrCreateDictionary(IDictionary<string, Dictionary<string, object>>, string)

Retrieves the dictionary associated with the specified key, or creates a new one if not found.

This method checks if the specified key exists in the outer dictionary. If the key is found, it returns the associated inner dictionary. If the key does not exist, it creates a new inner dictionary, adds it to the outer dictionary, and returns it.

public static IDictionary<string, object> GetOrCreateDictionary(this IDictionary<string, Dictionary<string, object>> dictionaryToDictionary, string key)

Parameters

dictionaryToDictionary IDictionary<string, Dictionary<string, object>>

The outer dictionary which maps a string key to another dictionary.

key string

The key used to access the inner dictionary.

Returns

IDictionary<string, object>

An inner dictionary of type IDictionary<string,object> associated with the specified key.

Exceptions

ArgumentNullException

Thrown when the outer dictionaryToDictionary is null.