将字节添加到数组中删除大写字母
我尝试向数组添加一个字节,如下所示:
messagedata.Add((byte)0xF0);
但是当我检查数组时,该项目看起来像 0xf0,但由于它将是一条 MIDI 消息,我发现它必须是大写 F。我能做什么保持字母大写?
I try to add a byte to an array as shown below:
messagedata.Add((byte)0xF0);
But then when I check the array, the item looks like 0xf0 but it since it's going to be a MIDI message I found it has to be a capital F. What can I do to keep the letters capitalized?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不可能保持字母大写,因为字母不存储在数组中。数组中存储的唯一内容是数值,而
0xf0
只是将该值表示为文本的方法之一。您不需要将字母保持大写。 MIDI 消息以字节而非文本形式发送,因此
0xf0
和0xF0
是相同值的文本表示。还有其他方法可以将相同的值表示为文本,例如240
、0360
或%11110000
,并且它们都表示相同的内容。此代码:
产生与上面的代码完全相同的结果。可执行代码将是相同的,并且不可能通过检查编译的代码来确定使用了哪些代码。
It's not possible to keep the letter capitalized, because the letters aren't stored in the array. The only thing stored in the array is a numerical value, and
0xf0
is just one of the way to represent that value as text.You don't need to keep the letter capitalized. A MIDI message is sent as bytes, not text, so
0xf0
and0xF0
are textual representations of the same value. There are other ways to represent the same value as text, as240
,0360
or%11110000
, and they all mean the same thing.This code:
produces the exact same result as your code above. The executable code will be identical, and it's not possible to determine which code was used by examining the compiled code.
0xF0 和 0xf0 是同一件事。当您查看并看到 0xf0(使用调试器或其他工具)时,该工具只是决定使用小写字母。 F和f都表示4位全等于1
0xF0 and 0xf0 are the same thing. When you look and see 0xf0 (with a debugger or whatever) that tool simply decided to use lower case letters. F and f both mean 4 bits all equal to 1