📜  c# 我在将 int 转换为字符串时丢失 0 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:00.285000             🧑  作者: Mango

代码示例1
int myNumber = 010;
string myString = myNumber.ToString("D3");
Console.Write(myString);

/* D represents 'Decimal', and 3 is the specified amount of digits you want
   the number to always be. This will pad your value with zeroes until it 
   reaches 5 digits.*/