Money data type for .NET?

后端 未结 8 1045
Happy的楠姐
Happy的楠姐 2021-01-31 02:52

Looking for a good Money data type for .NET that supports currencies and exchange rates (with related behaviour & operatio

8条回答
  •  面向向阳花
    2021-01-31 03:57

    I do understand your points about the benefit of having abstraction layer over money here. However, my view on money and its "operations" is quite blurry. For other things like File, it's clear to me there should be Open, Read, Write, Close operations. But for Money, I can't think of much other than basic math operations (+,-,*,/)

    One of C++ quantitative finance lib I know does contain this Money abstraction (http://quantlib.org/reference/class_quant_lib_1_1_money.html.) But you can clearly see that this is a very thin wrapper which provide basic operator overloads and unit conversion over Decimal.

    In most cases, I think decimal can fulfill your requirement. If there is specific Money operation you need to support, I think it's okay to roll out your own classes.

提交回复
热议问题