Skip to main content
Generalized from c# to .Net, since the question is about a .net class, and answers compare c# to vb.net
Link

What is the purpose of Decimal.One, Decimal.Zero, Decimal.MinusOne in C#.Net

added 269 characters in body
Source Link
Jasmine
  • 4k
  • 2
  • 32
  • 40

Simple question - why does the Decimal type define these constants? Why bother?

I'm looking for a reason why this is defined by the language, not possible uses or effects on the compiler. Why put this in there in the first place? The compiler can just as easily in-line 0m as it could Decimal.Zero, so I'm not buying it as a compiler shortcut.

Simple question - why does the Decimal type define these constants? Why bother?

Simple question - why does the Decimal type define these constants? Why bother?

I'm looking for a reason why this is defined by the language, not possible uses or effects on the compiler. Why put this in there in the first place? The compiler can just as easily in-line 0m as it could Decimal.Zero, so I'm not buying it as a compiler shortcut.

edited tags
Link
JaredPar
  • 759.3k
  • 152
  • 1.3k
  • 1.5k
Source Link
Jasmine
  • 4k
  • 2
  • 32
  • 40
Loading