translate int to string with x 0 before csharp

Code Example - translate int to string with x 0 before csharp

                
                        using System;
					
public class Program
{
	public static void Main()
	{
		int num = 50;
		string paddedNum = num.ToString().PadLeft(5, '0');
		
		Console.WriteLine(paddedNum);
	}
}
                    
                
 

csharp i lose 0 when converting int to string

                        
                                int myNumber = 010;
string myString = myNumber.ToString("D3");
Console.Write(myString);

/* D represents 'Decimal', and 3 is the specified amount of digits you want
   the number to always be. This will pad your value with zeroes until it 
   reaches 5 digits.*/