tring s2 = string.Format("{0:00.0}",iVal).TrimEnd('0'); // returns 00., 01., 02. when ival in {1,2,..};
int iVal;
string s3 = string.Format("{0,2:X}",iVal)+".";
// for 0 s3 will be "00."
// for 1 s3 will be "01."
// for 255 s3 will be "FF."
Here is an example to understand the comma in the format e.g. "{0,2:X}"
int a = 9;
int b=99;
int c = a +b;
string s4 = string.Format("The sum of {0,0:00} and {1,0:00} is {2,0:000}",a,b,c);
// s4 ="The sum of 09 and 99 is 109"
The 0,1,2 are associated to the a,b respectively c variable.
0:00, 0:00, 0:000 are associated format for a,b respectively c.
-obislavu-