문제

I’m looking for method that will return string representation of byte data just like hex editor can. It should have one parameter which is byte[] and returns string like the following: Like it should be

This method should handle escape characters, nulls and align text properly. I want to use it in Debug.WriteLine(). Please help me with this! Thanks!

Update: Ok. Thank you all guys. Here is a link for a ready to use solution http://illegalargumentexception.blogspot.fr/2008/04/c-file-hex-dump-application.html by Darin Dimitrov

도움이 되었습니까?

해결책

You could use the ToString method:

public static string ToString(byte[] buffer)
{
    return BitConverter.ToString(buffer);
}

다른 팁

try this :

  byte[] b1 = ...

  string h = System.Text.Encoding.UTF8.GetString(b1);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top