Created
November 11, 2015 06:22
-
-
Save fpGHwd/a1b34812f4623c001134 to your computer and use it in GitHub Desktop.
c# byte to hex string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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