I need to create a C# program that does the following:
Converts a character such as 'S' to 0x53 or 83 decimal and I need to print it on the screen as
char hex decimal
S 53 83
can anyone help.
thanks,
barry
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mike GoldPosted Mar 20, 2007, 7:35 PM
using
System;using System.Collections.Generic;
using System.Text;
namespace testhex
{ class Program
{ static void Main(string[] args)
{
char c = 'S';
Console.WriteLine("{0} {1} {2}", c, ((int) c).ToString("x"), ((int) c).ToString());
Console.ReadLine();
}
}
}