예제 #1
0
        public static TSource FirstOrDefault <TSource>(this List <TSource> source, Func <TSource, bool> predicate)
        {
            var aggregate = new FirstOrDefaultPredicate <TSource>(predicate);

            ListSegmentNode.ProcessList(source, ref aggregate);
            return(aggregate.GetResult());
        }
예제 #2
0
        public static TSource FirstOrDefault <TSource>(this ReadOnlyMemory <TSource> source, Func <TSource, bool> predicate)
        {
            var aggregate = new FirstOrDefaultPredicate <TSource>(predicate);

            MemoryNode.ProcessMemory(source, ref aggregate);
            return(aggregate.GetResult());
        }
예제 #3
0
        public static TSource FirstOrDefault <TSource>(this TSource[] source, Func <TSource, bool> predicate)
        {
            var aggregate = new FirstOrDefaultPredicate <TSource>(predicate);

            ArrayNode.ProcessArray(source, ref aggregate);
            return(aggregate.GetResult());
        }