Is generic Money<TAmount> a good implementation idea?
- by jdk
I have a Money Type that allows math operations and is sensitive to exchange rates so it will reduce one currency to another if rate is available to calculate in a given currency, rounds by various methods. It has other features that are sensitive to money, but I need to ask if the basic data type used should be made generic in nature.
I've realized that the basic data type to hold an amount may differ for financial situations, for example:
retail money might be expressed as all cents using int or long where fractions of cents do not matter,
decimal is commonly used for its fixed behaviour,
sometimes double seems to be used for big finance and large values
sometimes a special BigInteger or 3rd-party type is used.
I want to know if it would be considered good form to turn Money into Money<T_amount> so it can be used in any one of the above chosen scenarios?