예제 #1
0
        public async Task <int> SumAsync(IEnumerable <KeyValuePair <Attribute, int> > rawAttributes, Attribute attribute)
        {
            var tmp = rawAttributes.GroupBy(x => x.Key);
            var ret = tmp.Where(x => x.Key == attribute).Select(x => x.Sum(y => y.Value));

            return(await Task.FromResult(ret.FirstOrDefault()).ConfigureAwait(false));
        }
예제 #2
0
 public int Sum(IEnumerable <KeyValuePair <Attribute, int> > rawAttributes, Attribute attribute) =>
 SumAsync(rawAttributes, attribute).Result;