STRING TO HEX如何添加一个向量ob字节?

我有以下代码:

string s = "2563MNBJP89256666666685755854"; Byte[] bytes = encoding.GetBytes(s); string hex = ""; foreach (byte b in bytes) { int c=b; hex += String.Format("{0:x2}", (uint)System.Convert.ToUInt32(c.ToString())); } 

它打印hex值。 我怎样才能将它添加到像这样的向量ob字节?

 new byte [0x32,0x35..] 

In hex I have : 323536...等等。 下一步是to add then in a byte[] vector in the following format 0x32,0x35..and so on; How to do this? to add then in a byte[] vector in the following format 0x32,0x35..and so on; How to do this?

谢谢

是不是bytes已经是你想要的字节列表?

C#: System.Text.Encoding.ASCII.GetBytes("test")

对于C#你可以尝试

 System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding(); Byte[] bytes = encoding.GetBytes(strVar);//strVar is the string variable 

在C#中可以使用Encoding.GetBytes方法