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