Which is the better data type for storing monetary

2019-09-19 01:44发布

In Sharepoint 2010, the "field types" (data types) for list items that could presumably be used for monetary values are Decimal and Currency. Normally, decimal is the preferred data type in C# for money.

But what of this Currency type? Based on its name, it seems it may be the more suitable of the two. Is it?

I could also use integer (where 1225 represents $12.25, for instance) or String (where "12.25" represents $12.25), but the first two mentioned (Decimal and Currency) would seem to be the best bets.

UPDATE

Oddly enough, I was going to provisionally go with "Decimal" in my list, but SPFieldType actually doesn't seem to have a Decimal member available, so for now I'm going with Currency. According to page p. 230 of "Inside MS Sharepoint 2010," though, Decimal is one of the types...???

0条回答
登录 后发表回答