Skip to content

A simple Money type for .NET. It doesn't convert or format. That can be its own project. This is just about the money.

Notifications You must be signed in to change notification settings

scotthannen/Plasticfloor.Money

Repository files navigation

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.

About

A simple Money type for .NET. It doesn't convert or format. That can be its own project. This is just about the money.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages