D开发者_如何学Cim intChunkId As Integer = &H4D546864
Dim strChunkId As String = "MThd"
Dim easiestWay = GetString(intChunkId)
easiestWay
should now equal strChunkId
.
Dim bytes As Byte() = BitConverter.GetBytes(intChunkId)
Dim strChunkId As String = Encoding.ASCII.GetString(bytes)
A couple of points:
- This assumes the bytes in the integer are all the ASCII range (the ones in your example are, but they might not always be: in that case, you can use
Encoding.Default
.) - My VB is a bit rusty, I'm not sure I got the declaration of arrays right...
精彩评论