System.Numbers.AsPercentageOf C# (CSharp) Метод

AsPercentageOf() публичный статический Метод

public static AsPercentageOf ( this part, decimal total ) : Percentage
part this
total decimal
Результат Percentage
        public static Percentage AsPercentageOf(this decimal part, decimal total)
        {
            total.Must(d => d != 0m, "Can't divide by 0");
            return Math.Round(part * 100 / total, 2);
        }
    }