0

Possible Duplicate:
Converting from byte[] to string

How to convert from byte[] to string when we are importing a excel .?

Community
  • 1
  • 1
  • Byte array as in strings or byte array as in a raw excel document? – jgauffin Jul 19 '10 at 09:56
  • What is the `byte[]`? are you, for example, expecting it to be text? And if so, from what encoding? Or is it a non-text source, and you want hex/base-64/what? – Marc Gravell Jul 19 '10 at 10:00

4 Answers4

4
string myString =System.Text.Encoding.UTF8.GetString(myByteArray);
Flakron Bytyqi
  • 3,234
  • 20
  • 20
1
Encoding.Default.GetString(yourbytearray)
leppie
  • 115,091
  • 17
  • 196
  • 297
0
byte[] b = new byte[100];
string ascii_string = System.Text.ASCIIEncoding.ASCII.GetString(b); // For ascii string
string uni_string = System.Text.Encoding.UTF8.GetString(b); // For Unicode String
MD Sayem Ahmed
  • 28,628
  • 27
  • 111
  • 178
0

That's be the Encoding namespaces.

For example this method takes a byte array and returns a string

return System.Text.Encoding.UTF8.GetString(byteArray);
Russ Clarke
  • 17,511
  • 4
  • 41
  • 45