Home All Groups Group Topic Archive Search About

Convert char array To byte array

Author
13 Jul 2006 2:24 AM
Elioth
Hi...

I need to know how to convert Char Array to Byte Array and vice-versa in VB
2K5

Thanks for all help.
Elioth

Author
13 Jul 2006 5:54 AM
Mattias Sjögren
>I need to know how to convert Char Array to Byte Array and vice-versa in VB
>2K5

If you want to do a straight memory copy where one Char takes two
Bytes, use System.Buffer.BlockCopy(). Otherwise use the appropriate
Encoding class from the System.Text namespace and call the GetChars
and GetBytes methods.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.