A simple Money type for .NET. It doesn't convert or format. That can be its own project. This is just about the money.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Plasticfloor.Money.Tests
Plasticfloor.Money
Plasticfloor.Money35
Plasticfloor.Money40
Plasticfloor.Nuget
.gitattributes
.gitignore
Plasticfloor.Money.sln
README.md

README.md

Plasticfloor.Money

Plasticfloor.Money is currency and amount, and nothing else. It doesn't convert currencies. It doesn't format because it doesn't know how you want your money to look. Those are worthy causes to address in other projects, but not in this one. This is an abstraction of money.

Download the NuGet package. Provide input on codereview.stackexchange.com or e-mail me directly.

var money = new Money(5.05M, Currency.HRK);
var moreMoney = money + .1050001M;
var rounded = Money.Round(moreMoney, 2);
var roundedHowYouWantIt = Money.Round(moreMoney, 2, MidpointRounding.AwayFromZero);
decimal amount = money.Amount;
var notAllowed = new Money(1, Currency.EUR) + new Money(1, Currency.USD); // CurrencyMismatchException
  • It's immutable.
  • You can serialize it.
  • There's a MoneyDto if for any reason you can't transfer a struct containing an enum.
  • I'll add classes to handle formatting but I'm inclined to keep that separate.