using System;
using System.Text;
public static class MyExtensionMethods
{
public static string ToHex(this byte[] data)
{
if (data == null)
{
return null;
}
if (data.Length == 0)
{
return string.Empty;
}
StringBuilder sbHash = new StringBuilder();
foreach (byte b in data)
{
sbHash.AppendFormat("{0:X2}", b);
}
return sbHash.ToString();
}
}
Writes some byte array into a string sequence.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.