AuthBridge.Clients.Util.DictionaryExtensions.AddItemIfNotEmpty C# (CSharp) Метод

AddItemIfNotEmpty() публичный статический Метод

Adds a key/value pair to the specified dictionary if the value is not null or empty.
public static AddItemIfNotEmpty ( string>.this dictionary, string key, string value ) : void
dictionary string>.this /// The dictionary. ///
key string /// The key. ///
value string /// The value. ///
Результат void
        public static void AddItemIfNotEmpty(this IDictionary<string, string> dictionary, string key, string value)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (!string.IsNullOrEmpty(value))
            {
                dictionary[key] = value;
            }
        }