public static IEnumerable <T> AddIfNotNull <T>(this IEnumerable <T> source, T value) { return(Colls.AddIf(source, value, v => v is not null)); }
public static IEnumerable <T> AddIf <T>(this IEnumerable <T> source, T value, Func <T, bool> condition) { return(Colls.AddIf(source, value, condition)); }
public static IEnumerable <T> AddIfNotExist <T>(this IEnumerable <T> source, T value, Func <T, bool> existFunc = null) { Func <T, bool> condition = t => !source.Contains(t); return(Colls.AddIf(source, value, v => existFunc?.Invoke(v) ?? condition(v))); }
public static IEnumerable <T> AddIf <T>(this IEnumerable <T> source, T value, bool flag) { return(Colls.AddIf(source, value, flag)); }