public static string ToHexString(byte[] bytes) { if (bytes == null) { throw new ArgumentNullException("bytes"); } var sb = new StringBuilder(bytes.Length * 2); foreach (var b in bytes) { sb.AppendFormat("{0:x2}", b); } return sb.ToString(); }
/// <summary> /// Returns a string representation of the value. /// </summary> /// <returns>A string representation of the value.</returns> public override string ToString() { return(BsonUtils.ToHexString(ToByteArray())); }