コード例 #1
0
        public static TSource?FirstOrNull <TSource>(this IReadOnlyList <TSource> source, Func <TSource, bool> predicate)
            where TSource : struct
        {
            switch (source)
            {
            case TSource[] array:
                return(ArrayExtensions.FirstOrNull <TSource>(array, predicate));

            default:
                return(ReadOnlyList.FirstOrNull <IReadOnlyList <TSource>, IEnumerator <TSource>, TSource>(source, predicate));
            }
        }