Monday, April 24, 2006

Convert String to Byte Array

Thanks dave, this is a great piece of code however more blog entries showed there was a flaw (at least for my milage). Saved me some time though. Why microsoft doesnt have this natively in the .net framework is also beyond me. The sample below is my slightly modified version which does do the conversion correctly.

Imports System.Text  Public Shared Function ConvertStringToByteArray(ByVal stringToConvert As String) As Byte()     Return System.Text.Encoding.ASCII.GetBytes(stringToConvert.ToCharArray()) End Function


Convert String to Byte Array

No comments: