Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 872 Bytes

README.md

File metadata and controls

43 lines (30 loc) · 872 Bytes

logo2

Simple helpers to count percentage and more.

> Install-Package PercentageNET -Version 1.0.0

Documentation

Count 20% from 1000:

var result = PercentageHelper.Count(1000, 20);
// result = 200

Substract 20% from 1000

var result = PercentageHelper.Substract(1000, 20);
// result = 800

Add 20% to 1000 (simple mode)

var result = PercentageHelper.Add(1000, 20);
// result = 1200

Add 20% to 1000 (upcharge mode1)

var result = PercentageHelper.Add(1000, 20, AddMode.Upcharge);
// result  = 1250

Todo

  • Tests
  • More helpers

Footnotes

  1. For example you need to upcharge your items for sale. Use this mode to get "real" percentage for following discount on this amount.