Hex Class

  • Thread starter Thread starter BuddyWork
  • Start date Start date
Why just not to
MyString = Int64.Parse(MyValue,System.Globalization.NumberStyles.HexNumber)
?
 
Hello Tamir,

I need to convert a string to byte[] which is what the
function DecodeHexString() does.

Thanks,
 
Hello Tamir,

I need to convert a string to byte[] which is what the
function DecodeHexString() does.

Thanks,
<snip>

I vaguely remember doing some stuff like that using the
system.text.encoding class perhaps
 
Hi,

I not sure whether there is a hex class in .NET.

But this is how i do:

String -> Char[] -> Byte[] -> Hex (to display)

// convert string to character array
char [] keyValue = KeyTextBox.Text.ToCharArray();

// convert character array to byte array
byte [] keyByte = Encoding.ASCII.GetBytes(keyValue);

// Format the byte into hexadecimal
string str = "";
str += string.Format("{0:x2}", keyByte);

To convert Hex back to Bytes:

you can look into Byte.Parse(,);

Correct me if i am wrong. Thanks.
--
Regards,
Chua Wen Ching :)


BuddyWork said:
Hello Tamir,

I need to convert a string to byte[] which is what the
function DecodeHexString() does.

Thanks,
-----Original Message-----
Why just not to
MyString = Int64.Parse (MyValue,System.Globalization.NumberStyles.HexNumber)
?


--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "





.
 
byte[] bytes = Encoding.UTF8.GetBytes(somString);

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "


BuddyWork said:
Hello Tamir,

I need to convert a string to byte[] which is what the
function DecodeHexString() does.

Thanks,
-----Original Message-----
Why just not to
MyString = Int64.Parse (MyValue,System.Globalization.NumberStyles.HexNumber)
?


--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top