Sign up ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Is it possible to write this method in a prettier way?

public static string ByteArrayToString(byte[] byteArray)
  var hex = new StringBuilder(byteArray.Length * 2);
  foreach (var b in byteArray)
    hex.AppendFormat("{0:x2}", b);
  return hex.ToString();
share|improve this question

1 Answer 1

up vote 7 down vote accepted

There are popular topics on StackOverflow that cover this exact question:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.