CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    173

    Binary array to string

    What is the best (fastest) way to convert a string stored in a binary array to a string object?

  2. #2
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    173

    Lightbulb

    At long last after hours of research I have found the stupid answer.

    To convert a byte array to string use and vice-versa :
    Code:
    dim enc As New System.Text.ASCIIEncoding
    dim bytes() As Byte
    dim strMessage as String
    
    strMessage = "Hello World"
    
    bytes = enc.GetBytes(strMessage)
    strMessage = enc.GetString(bytes)
    Why is .NET stuff like this so stupidly easy but such a pain in the axe to find documented?

    Rats,

    pjp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured