CollectionUtility.AddIfNotNull<T> method (1 of 2)

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.

See Also


CollectionUtility.AddIfNotNull<T> method (2 of 2)

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.

See Also