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:

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: