Saturday, November 22, 2014

asp net c# How do you convert Byte Array to Hexadecimal String, and vice versa?

public byte[] GetStringToBytes(string value)
{
 var shb = System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary.Parse(value);
 return shb.Value;
}
 
public string GetBytesToString(byte[] value)
{
 var shb = new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary(value);
 return shb.ToString();
}

No comments:

Post a Comment