Viyi.Util/Linq/Enumerable_MM.gen.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// This file is generated by Viyi.Util.Build, please keep it as it is.

using System;
using System.Collections.Generic;
using System.Linq;

#if NETSTANDARD2_0 || NETSTANDARD2_1
namespace System.Linq;

public static partial class EnumerableExtensions
{

    public static T MaxBy<T>(this IEnumerable<T> source, Func<T, int> selector) {
        return source.Aggregate((last, next) =>
            selector(next) > selector(last) ? next : last
        );
    }

    public static T MinBy<T>(this IEnumerable<T> source, Func<T, int> selector) {
        return source.Aggregate((last, next) =>
            selector(next) < selector(last) ? next : last
        );
    }

    public static T MaxBy<T>(this IEnumerable<T> source, Func<T, uint> selector) {
        return source.Aggregate((last, next) =>
            selector(next) > selector(last) ? next : last
        );
    }

    public static T MinBy<T>(this IEnumerable<T> source, Func<T, uint> selector) {
        return source.Aggregate((last, next) =>
            selector(next) < selector(last) ? next : last
        );
    }

    public static T MaxBy<T>(this IEnumerable<T> source, Func<T, short> selector) {
        return source.Aggregate((last, next) =>
            selector(next) > selector(last) ? next : last
        );
    }

    public static T MinBy<T>(this IEnumerable<T> source, Func<T, short> selector) {
        return source.Aggregate((last, next) =>
            selector(next) < selector(last) ? next : last
        );
    }

    public static T MaxBy<T>(this IEnumerable<T> source, Func<T, ushort> selector) {
        return source.Aggregate((last, next) =>
            selector(next) > selector(last) ? next : last
        );
    }

    public static T MinBy<T>(this IEnumerable<T> source, Func<T, ushort> selector) {
        return source.Aggregate((last, next) =>
            selector(next) < selector(last) ? next : last
        );
    }

后面还有 87 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。