16进制转换为2进制的方法
/// <summary> /// //16转2方法 /// </summary> /// <param name="hexString"></param> /// <returns></returns> static string HexString2BinString(string hexString) { try { string result = string.Empty; foreach (char c in hexString) { int v = Convert.ToInt32(c.ToString(), 16); int v2 = int.Parse(Convert.ToString(v, 2)); // 去掉格式串中的空格,即可去掉每个4位二进制数之间的空格, result += string.Format("{0:d4} ", v2); } return result.Replace(" ",""); } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }