Is there any practical difference between the .net decimal values 1m and 1.0000m?

后端 未结 3 1971
时光取名叫无心
时光取名叫无心 2020-12-30 05:50

Is there any practical difference between the .net decimal values 1m and 1.0000m?

The internal storage is different:

1m      : 0x00000001 0x00000000          


        
3条回答
  •  再見小時候
    2020-12-30 05:59

    The only reason I can think of is so invoking `ToString returns the exact textual representation in the source code.

    Console.WriteLine(1m); // 1
    Console.WriteLine(1.000m); // 1.000
    

提交回复
热议问题