123456789101112131415161718192021 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace InABox.Mobile
- {
- public abstract class AbstractCombiner<TValue,TFunction> : AbstractMultiConverter<TValue,TValue>
- where TFunction : struct, IConvertible
- {
- public TFunction Function { get; set; }
-
- protected abstract TValue Combine(TValue current, TValue next);
- protected override TValue Convert(IEnumerable<TValue> value, object parameter = null)
- {
- if (value?.Any() != true)
- return default;
- return value.Aggregate<TValue,TValue>(default,Combine);
- }
- }
- }
|