应用介绍
Money的通用类型(包括您的自定义类型)
一元算术
任意数的二进制算术
涉及相同货币的业务
涉及不同货币的业务
Create:
// create money with decimal type of amount in my currency
var localMoney = new Money<decimal>(100m);
// create Australian dollars
var aud = new Money<decimal>(42m, "AUD");
Operate:
var m1 = Money<decimal>(100m, "AUD");
var m2 = Money<decimal>(-42m, "AUD");
var m3 = Money<decimal>(3.1415m, "USD");
var m4 = Money<decimal>(1m, "EUR");
var m5 = Money<decimal>(8m, "GBP");
var audWallet = m1 + m2;
var audWalletValueAsMoney = audWallet.EvaluateWithoutConversion();
var multinationalWallet = (m1 % m5) + ((m2 * 3.5m) / m4) - (m3 * 9m);
var currencyConverter = new MyCurrencyConverter(); // this is some imaginary implementation of ICurrencyConverter<T>
var resultingMoneyInAUD = multinationalWallet.Evaluate(currencyConverter, "AUD");
©版权声明:本文内容由互联网用户自发贡献,版权归原创作者所有,本站不拥有所有权,也不承担相关法律责任。如果您发现本站中有涉嫌抄袭的内容,欢迎发送邮件至: www_apollocode_net@163.com 进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。
转载请注明出处: apollocode » C# money类
文件列表(部分)
名称 | 大小 | 修改日期 |
---|---|---|
money-master | 0.00 KB | 2020-05-08 |
money-master | 0.00 KB | 2020-05-30 |
Money | 0.00 KB | 2016-06-42 |
CachedCurrencyConverter.cs | 1.58 KB | 2016-06-42 |
Currency.cs | 3.51 KB | 2016-06-42 |
Exceptions | 0.00 KB | 2016-06-42 |
CurrencyMismatchException.cs | 0.55 KB | 2016-06-42 |
IncompatibleAmountTypeException.cs | 0.52 KB | 2016-06-42 |
IncompatibleMoneyTypeException.cs | 0.52 KB | 2016-06-42 |
ICurrencyConverter.cs | 0.15 KB | 2016-06-42 |
Internal | 0.00 KB | 2016-06-42 |
Helpers | 0.00 KB | 2016-06-42 |
BinaryOperationHelper.cs | 2.46 KB | 2016-06-42 |
NumericTypeHelper.cs | 1.11 KB | 2016-06-42 |
UnaryOperationHelper.cs | 1.36 KB | 2016-06-42 |
PassThroughCurrencyConverter.cs | 0.25 KB | 2016-06-42 |
Money.cs | 1.09 KB | 2016-06-42 |
Money.csproj | 4.69 KB | 2016-06-42 |
Money.csproj.DotSettings | 0.42 KB | 2016-06-42 |
Parts | 0.00 KB | 2016-06-42 |
BinaryOperationWithMoney.cs | 0.75 KB | 2016-06-42 |
BinaryOperationWithNumbers.cs | 3.34 KB | 2016-06-42 |
Comparable.cs | 1.82 KB | 2016-06-42 |
Equality.cs | 1.38 KB | 2016-06-42 |
UnaryOperators.cs | 1.23 KB | 2016-06-42 |
Properties | 0.00 KB | 2016-06-42 |
AssemblyInfo.cs | 1.35 KB | 2016-06-42 |
Wallet.cs | 2.57 KB | 2016-06-42 |
WalletComposer | 0.00 KB | 2016-06-42 |
MultiItemWallet.cs | 1.38 KB | 2016-06-42 |
Operation | 0.00 KB | 2016-06-42 |
AdditionOperation.cs | 0.32 KB | 2016-06-42 |
发表评论 取消回复