How to convert a byte array into a string in C#?

In applications where you have binary data in a byte array for e.g. data received via a SocketStream, and you need to convert it to a string to interpret it, here is how you do it:
string result = System.Text.Encoding.UTF8.GetString(byteArray)

8 comments:

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete
  2. Online Shopping in pakistan

    online shopping pakistan
    By shopping online through the famous online stores

    ReplyDelete
  3. process. The objective of this study is online shopping pakistan to provide an overview of online shopping decision
    Online Shopping in pakistan

    ReplyDelete
  4. I messaged her via Facebook inbox at like 4 at night and she would reply and take my order, just so I don't miss a sale! (this in no way means we should all do that, advance planning for sales is always a better idea) Online shopping Pakistan

    ReplyDelete
  5. Makeup & Accessories has to be my favorite store to order from! The owner, Sahr, is a lovely hardworking, super polite person who is always looking for ways to please her customers either by giving discounts, or freebies with your order! There have been times during a sale your own it department

    ReplyDelete
  6. This is really a nice post, that you have updated us with all of nice information that can be very useful for future. Send Gifts To pakistan

    ReplyDelete
  7. It was nice unblock game . Very informative and expressive .things are easily play online at
    unblocked game

    ReplyDelete