Example #1
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)));
        }
Example #2
0
        public static async ValueTask <object> SetObjectRankAsync(this IObjectRanking ranking,
                                                                  Func <object, object> newRankFactory, CancellationToken cancellationToken = default)
        {
            ranking.NotNull(nameof(ranking));
            newRankFactory.NotNull(nameof(newRankFactory));

            var newRank = await ranking.GetObjectRankAsync(cancellationToken).ConfigureAwait();

            return(await ranking.SetObjectRankAsync(newRankFactory.Invoke(newRank), cancellationToken)
                   .ConfigureAwait());
        }