Convert Byte[]( Byte Array) to String
Here 'b' is the byte array
C#
string strModified = System.Text.Encoding.Unicode.GetString(b);
VB.NET
Dim strModified As String = System.Text.Encoding.Unicode.GetString(b)
Convert a String to Byte[] (Byte Array)
C#
byte[] b = Encoding.Unicode.GetBytes(strOriginal);
VB.NET
Dim b As Byte() = Encoding.Unicode.GetBytes(strOriginal)
Tweet
2 comments:
For a round trip byte[] -> string -> byte[], you are much safer using Convert.ToBase64String and FromBase64String
Nice one John!!
thks
Post a Comment