开发者

Datatype within C#

开发者 https://www.devze.com 2022-12-09 10:24 出处:网络
Is there a datatype within C# that if you put to for example 0001, and add 1, will be 0开发者_StackOverflow社区002?No, but you could emulate this functionality with an integer and:

Is there a datatype within C# that if you put to for example 0001, and add 1, will be 0开发者_StackOverflow社区002?


No, but you could emulate this functionality with an integer and:

String.Format("{0:0000}", no);


Just use int.

int i=1;
Console.WriteLine(i.ToString("0000"));
i++;
Console.WriteLine(i.ToString("0000"));

Here's the result:

0001
0002
0

精彩评论

暂无评论...
验证码 换一张
取 消