\$\begingroup\$
\$\endgroup\$
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();
}
Simon Forsberg
59.7k9 gold badges157 silver badges311 bronze badges
asked Nov 29, 2012 at 8:57
1 Answer 1
\$\begingroup\$
\$\endgroup\$
2
There are popular topics on StackOverflow that cover this exact question:
answered Nov 29, 2012 at 9:04
-
\$\begingroup\$ It seems that just as on StackOverflow, consensus here is that link-only answers aren't preferable. \$\endgroup\$Gert Arnold– Gert Arnold2020年05月22日 18:50:29 +00:00Commented May 22, 2020 at 18:50
-
\$\begingroup\$ This answer refers to internal stackoverflow links, not external. Basically it says "this question has already been answered". I don’t see any reason to copy/paste the code from similar answers. \$\endgroup\$almaz– almaz2020年05月23日 19:16:03 +00:00Commented May 23, 2020 at 19:16
lang-cs