/// <summary> /// The sum of a sequence, with a delegate returning an integer /// for each element of the sequence. /// </summary> public static int Sum <TIn, TOut, TProducer>( this SpanEnumerable <TIn, TOut, TProducer> spanEnum, Func <TOut, int> getValue) where TProducer : struct, IProducer <TIn, TOut> => spanEnum.Select(getValue).Sum();
/// <summary> /// The sum of a sequence, with a delegate returning an integer /// for each element of the sequence. /// </summary> public static int Sum <TOut>( this SpanEnumerable <TOut> spanEnum, Func <TOut, int> getValue) => spanEnum.Select(getValue).Sum();