prabhuK2k prabhuK2k - 10 days ago 4x
C# Question

Converting single digit to more than 2digits

I'am having a number and Its length will be more than 10digits, So that i can't save it in an INTEGER variable. So i saved it in a LONG variable. Now the Problem is, while adding a number with that LONG Variable it returns a Round value. I'm working in C#.

For Eg:

long empId = 00000000001;
long answer = empId + 1; // 00000000001 + 1 = 2;
// answer == 2;

but expected answer is " 00000000002", How to achieve this..

Thanks In Advance..


Consider using empId.ToString("D11") if you want your number to be padded with zeroes to the left until there's a total of 11 figures. This is only a string representation of the System.Int64 (also called long in C#).