Skip to content

Instantly share code, notes, and snippets.

@fpGHwd
Created November 11, 2015 06:22
Show Gist options
  • Save fpGHwd/a1b34812f4623c001134 to your computer and use it in GitHub Desktop.
Save fpGHwd/a1b34812f4623c001134 to your computer and use it in GitHub Desktop.
c# byte to hex string
/// <summary>
/// 字节数组转16进制字符串
/// </summary>
/// <param name="bytes"></param>
/// <returns></returns>
public static string byteToHexStr(byte[] bytes)
{
string returnStr = "";
if (bytes != null)
{
for (int i = 0; i < bytes.Length; i++)
{
returnStr += bytes[i].ToString("X2");
}
}
return returnStr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment