Adds the specified value to the collection if the value is not null.
public static void AddIfNotNull<T>(this ICollection<T> collection, T? value)
parameter | description |
---|---|
T | The type of item in the collection. |
collection | The collection. Must not be null. |
value | The value to add. May be null. |
Adds the specified value to the collection if the value is not null.
public static void AddIfNotNull<T>(this ICollection<T> collection, T? value)
where T : struct
parameter | description |
---|---|
T | The type of item in the collection. |
collection | The collection. Must not be null. |
value | The value to add. May be null. |