Search Amazon:

Convert Strings to Byte Arrays and Back in .NET

Used the System.Text.Encoder namespace. This encoding only supports character values between U+0000 (0) and U+007F (127). Characters outside that range will not be translated correctly and will result in a loss of data.

    Imports System.Text.Encoder

    '
    ' Convert from string to Byte Array.
    '
    Dim oEncoder As New System.Text.ASCIIEncoding
    Dim bytArray() As Byte = oEncoder.GetBytes(strMyString)
    '
    ' And back again.
    '
    Console.WriteLine(oEncoder.GetString(bytArray))
Sign In
  User Id 
  Password 


Submit Your Own Code and Articles




About TheScarms
About TheScarms

Ask me your programming questions

I read every email and answer all I can.

User Feedback: Be the first to add a comment! Items to Show:     

     
You must log in to post feedback.
Comment:    
 

If you use this code, please mention "www.TheScarms.com"

Email this page


TheScarms AppSentinel lets you securely copy protect and create evaluation versions of your software

TheScarms(tm) AppSentinel lets you quickly and easily create evaluation versions of your software and stop unauthorized copying and unregistered use of your programs!

Get your free
trial copy today!


      The World's Number 1 Web Host

© Copyright 2008 TheScarms