Home / Code Snippets / Blog article: Convert Hexadecimal To Number In C#

| RSS

Convert Hexadecimal To Number In C#

March 24th, 2009 | No Comments | Posted in Code Snippets

To convert a Hexadecimal to a number we can use an overload of Convert.ToInt32 method.

Convert.ToInt32

Using the overload I can convert for example hex string “BB” to a number.

int number = Convert.ToInt32("BB", 16);

And the number variable gets assigned value of 187.

Leave a Reply 3768 views, 4 so far today |
Tags: ,

Leave a Reply