Пример #1
0
 public static TSource ElementAtOrDefault_ <TSource>(this IEnumerable <TSource> source, int index, RequireClass <TSource> _ = default)
     where TSource : class
 {
     return(Enumerable.ElementAtOrDefault(source, index) ?? Default <TSource> .Get());
 }
Пример #2
0
 public static TSource FirstOrDefault_ <TSource>(this IEnumerable <TSource> source, RequireClass <TSource> _ = default)
     where TSource : class
 {
     return(Enumerable.FirstOrDefault(source) ?? Default <TSource> .Get());
 }
Пример #3
0
 public static TSource SingleOrDefault_ <TSource>(this IEnumerable <TSource> source, Func <TSource, bool> predicate, RequireClass <TSource> _ = default)
     where TSource : class
 {
     return(Enumerable.SingleOrDefault(source, predicate) ?? Default <TSource> .Get());
 }