Defining different types of numbers in C#

后端 未结 3 1329
清酒与你
清酒与你 2020-12-16 11:55

You can define a number in various ways in C#,

1F // a float with the value 1
1L // a long with the value 1
1D // a double with the value 1

3条回答
  •  独厮守ぢ
    2020-12-16 12:37

    for money:

    decimal mon = 1m;
    

    for output:

    string curr = String.Format("{0:C}", mon);  //output $1.00
    

提交回复
热议问题