by
7,382 32
2
6
10k
12
Top 1% !
Popular
Famous
Pearl of Wisdom
Specified
Refined
Popularity: 420th place
Created
Modified Sep 15, 2013
This snippet is Public
No tags for this snippet yet.
.NETFramework4.0
Architecturex86_64
Extension.cs
InputName0input
InputType0byte[]
LanguageCSharp
LicenseMIT_X11
MethodNamePrintHexByteArray
OSWindows
OutputTypestring
Windows VersionWindows7

Simple C# method to print a byte array into hexadecimal value

Returns a string representation of input byte array as hexadecimal digits; string.Empty if input is null, the hexadecimal representation otherwise.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/11193/Simple-C--method-to-print-a-byte-array-i?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public static string PrintHexByteArray(this byte[] input) { if (input == null) return string.Empty; StringBuilder sbs = new StringBuilder(); for (int i = 0; i < input.Length; i++) { sbs.Append(input[i].ToString("X2")); } return sbs.ToString(); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus