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
and 0xF0
are textual representations of the same value. There are other ways to represent the same value as text, as 240
, 0360
or %11110000
, and they all mean the same thing.
This code:
messagedata.Add((byte)240);
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.