开发者

Datatype within C#

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜