.net – Pad a number with starting zero in .Net

.netformattingpaddingstring

I have a requirement to pad all single digits numbers with a starting zero.
Can some one please suggest the best method? (ex 1 -> 01, 2 -> 02, etc)

Best Solution

number.ToString().PadLeft(2, '0')