请问字符串怎么转换成byte ( C#)
byte[] pszBufIn=new byte[256]
我有两字符串
string str ="上海";
string str2="北京";
我要实现这样的功能,
前六个字节显示上海,不足的补零
pszBufIn[0]=0xc9
pszBufIn[1]=0xcf
pszBufIn[2]=0xba
pszBufIn[3]=0xa3
pszBufIn[4]=0x00
pszBufIn[5]=0x00
然后我从第六个字节显示 str2的内容
pszBufIn[6]=0xxx
pszBufIn[7]=0xxx
pszBufIn[8]=0xxx
pszBufIn[9]=0xxx
pszBufIn[10]=0x00
pszBufIn[11]=0x00
.................. 谢谢