How to Convert Integer to Hexadecimal number in C# ?

Below is a sample sourecode demonstrating the conversion of the integer value to Hexadecimal number in c# with just one line of code.

How to Convert Integer to Hexadecimal number in C# ?

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication1

{

internal class Program

{

private static void Main(string[] args)

{

int Input = 10;

string Output = Input.ToString("X");

Console.WriteLine("The Hexadecimal value of 10 is " + Output);

Console.Read();

}

}

}
How to Convert Integer to Hexadecimal number in C# ?

Leave Your Comment

Liked this content?. Please spread the word :)