-1

I want to know how to convert a byte[] to string. I have variable K an integer array and pwd a byte[] hence the the code bellow is giving me errors?

public void temp()
{
    int[] k = new int[256];
    byte[] pwd;
    int temp = 50;
    k[tmp] = pwd[(tmp % Convert.ToString((string)pwd).Length)];
}
user2560413
  • 27
  • 2
  • 7
  • @user1666620 Indeed it would be good duplicate if OP actually specify what is expected input and output. "Give me right code" is simply not enough to know what actual goal/problem is. – Alexei Levenkov Jul 24 '15 at 15:31

1 Answers1

1

Presumably if it's in a byte array, it's encoded. If you know what encoding, simply call GetString on the encoding. For example, if it's UTF8 encoded:

Encoding.UTF8.GetString(pwd);
Charles Mager
  • 23,314
  • 2
  • 26
  • 33