5位数的计数器

Kat*_*ate 2 c# filenames counter auto-increment

我想要5位数的计数器,例如:00000,00001,00002 ....我用这个命令创建文件:

FileStream Fl = File.Create(@"C:\\U\\L\\Desktop\\" + "i" + (counter) + ".xml");
Run Code Online (Sandbox Code Playgroud)

柜台的定义:

int counter;
Run Code Online (Sandbox Code Playgroud)

我的增量: counter++;

你有什么想法,我怎么能做5位数的计数器?感谢所有的想法:)

Gur*_*ron 14

关于自定义数字格式字符串

int value = 123;
Console.WriteLine(value.ToString("00000"));
// Displays 00123 
Run Code Online (Sandbox Code Playgroud)