Rock.ExtensionMethods.Update C# (CSharp) Method

Update() public static method

Adds a new key/value to dictionary or if key already exists will update existing value.
public static Update ( object>.this dictionary, string key, object value ) : void
dictionary object>.this The dictionary.
key string The key.
value object The value.
return void
        public static void Update( this Dictionary<string, object> dictionary, string key, object value )
        {
            if ( dictionary != null )
            {
                if ( dictionary.ContainsKey( key ) )
                {
                    dictionary[key] = value;
                }
                else
                {
                    dictionary.Add( key, value );
                }
            }
        }