Exemplo n.º 1
0
    /// <summary>
    /// 设置对象排名。
    /// </summary>
    /// <param name="ranking">给定的 <see cref="IObjectRanking"/>。</param>
    /// <param name="newRankFactory">给定的新对象排名工厂方法。</param>
    /// <returns>返回排名(兼容整数、单双精度的排序字段)。</returns>
    public static object SetObjectRank(this IObjectRanking ranking,
                                       Func <object, object> newRankFactory)
    {
        var currentRank = ranking.GetObjectRank();

        return(ranking.SetObjectRank(newRankFactory(currentRank)));
    }
Exemplo n.º 2
0
        public static object SetObjectRank(this IObjectRanking ranking,
                                           Func <object, object> newRankFactory)
        {
            ranking.NotNull(nameof(ranking));
            newRankFactory.NotNull(nameof(newRankFactory));

            var newRank = ranking.GetObjectRank();

            return(ranking.SetObjectRank(newRankFactory.Invoke(newRank)));
        }