string a = 10 67 65 83 67 65 68 69 32 84 111 112 111 108 111 103 121 32 86 49 44 32 40 99 41 32 77 97 116 114 97 45 68 97 116 97 118 105 115 105 111 110 ;
字符串a不定长。
将字符串a存到byte [] b数组中,使得b[1] = 10;b[2] = 67;b[3]......
c#string字符串转存为byte[]数组
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
threenewbee 2019-03-22 11:27关注using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Q753065 { class Program { static void Main(string[] args) { string a = "10 67 65 83 67 65 68 69 32 84 111 112 111 108 111 103 121 32 86 49 44 32 40 99 41 32 77 97 116 114 97 45 68 97 116 97 118 105 115 105 111 110"; byte[] arr = a.Split(' ').Select(x => byte.Parse(x)).ToArray(); } } }
问题如果解决请点我回答左边的采纳
本回答被题主选为最佳回答 , 对您是否有帮助呢?评论 打赏 举报解决 4无用