using System.Numerics;

int[] ints= new int[] { 1,2,3,4};


var decimals= new decimal[] {11m,2.2m,3.3m,4.4m};

var sumi = AddAllN(ints);

var sumd = AddAllN(ints);


int AddAllS(int[] values)
{
    int result = 0;

    foreach (var item in values)
    {
        result += item;
    }

    return result;
}


T AddAllN<T>(T[] values) where T : INumber<T>
{
    T result = T.Zero;

    foreach (var item in values)
    {
        result += item;
    }

    return result;
}