public static AddItemIfNotEmpty ( string>.this |
||
dictionary | string>.this | /// The dictionary. /// |
key | string | /// The key. /// |
value | string | /// The value. /// |
return | 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;
}
}