Take a look at the following C# code:
decimal value1 = 1234M;
decimal value2 = 1234.00M;
Console.WriteLine(value1 == value2); // True
Console.WriteLine(value1); // 1234
Console.WriteLine(value2); // 1234.00
What are the differences between value1
and value2
that cause them to be formatted differently (different number of decimal places)?
They are equal values, so I'd expect that they'd be formatted in the same way. Does value2
somehow store somewhere that I created it with two decimal places? If yes, how can I see that and change that?