5
यह this one here जैसा प्रश्न है।बाइट से हेक्स स्ट्रिंग में कनवर्ट करने के लिए निर्मित फ़ंक्शन
क्या कोई अंतर्निहित विधि है जो बाइट को हेक्स स्ट्रिंग में परिवर्तित करती है? विशेष रूप से, मैं के लिए
/// <summary>
/// Convert bytes in a array Bytes to string in hexadecimal format
/// </summary>
/// <param name="Bytes">Bytes array</param>
/// <param name="Length">Total byte to convert</param>
/// <returns></returns>
public static string ByteToHexString(byte[] Bytes, int Length)
{
Debug.Assert(Length <= Bytes.GetLength(0));
StringBuilder hexstr = new StringBuilder();
for (int i = 0; i < Length; i++)
{
hexstr.AppendFormat("{0,02:X}", Bytes[i]);
}
hexstr.Replace(' ', '0'); //padd empty space to zero
return hexstr.ToString();
}
+1 कुछ हफ्तों पहले इस सटीक कोड लिखा ... –