c# hex to byte array code example
Example 1: c# string to byte array
string author = "Mahesh Chand";
// Convert a C# string to a byte array
byte[] bytes = Encoding.ASCII.GetBytes(author);
// Convert a byte array to a C# string.
string str = Encoding.ASCII.GetString(bytes);
Example 2: byte array to hex c#
public static string ByteArrayToString(byte[] ba)
{
return BitConverter.ToString(ba).Replace("-","");
}