Reputation: 3528
Is there a datatype within C# that if you put to for example 0001, and add 1, will be 0002?
Upvotes: 0
Views: 176
Reputation: 1129
No, but you could emulate this functionality with an integer and:
String.Format("{0:0000}", no);
Upvotes: 5
Reputation: 83254
Just use int.
int i=1;
Console.WriteLine(i.ToString("0000"));
i++;
Console.WriteLine(i.ToString("0000"));
Here's the result:
0001
0002
Upvotes: 4