我開始與下面的兩個值:添加值字節數組
finalString = "38,05,e1,5f,aa,5f,aa,d0";
string[] holder = finalString.Split(',');
我循環通持有人就像這樣:
foreach (string item in holder)
{
//concatenate 0x and add the value to a byte array
}
在每次迭代中,我想串連一個0x使其成爲十六進制值並將其添加到字節數組中。
這就是我想要的字節數組是當我完成循環,如:
byte[] c = new byte[]{0x38,0x05,0xe1,0x5f,0xaa,0x5f,0xaa,0xd0};
到目前爲止,我所有的嘗試都沒有成功。有人能指引我朝着正確的方向嗎?
很酷的想法,但是,這樣的字節是十六進制模式解析編輯您的帖子。 – 2010-05-28 15:00:47
s表示十六進制格式的值。它可能包含A到F的字母。byte.Parse需要指定格式的第二個參數。 – 2010-05-28 15:02:59