Beispiel #1
0
 public static IEnumerable <T> AddIfNotNull <T>(this IEnumerable <T> source, T value)
 {
     return(Colls.AddIf(source, value, v => v is not null));
 }
Beispiel #2
0
 public static IEnumerable <T> AddIf <T>(this IEnumerable <T> source, T value, Func <T, bool> condition)
 {
     return(Colls.AddIf(source, value, condition));
 }
Beispiel #3
0
        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)));
        }
Beispiel #4
0
 public static IEnumerable <T> AddIf <T>(this IEnumerable <T> source, T value, bool flag)
 {
     return(Colls.AddIf(source, value, flag));
 }