[英]C# byte arrays questions
I have a couple questions about byte arrays 我对字节数组有几个问题
My first question this is a byte array correct? 我的第一个问题是字节数组正确吗?
byte[] array = {0x90, 0x38, 0x83, 0x49}
question 2 is would memorystream.ToArray();
问题2是
memorystream.ToArray();
produce the same as question 1 or am I wrong. 产生与问题1相同的结果或我错了。
If i am wrong how can i produce question 1 with question 2 or is it not possible? 如果我错了,我该如何将问题1和问题2相提并论?
Thank you 谢谢
Q1: byte[] array
is an array of type "byte" which is commonly referred to as "byte array". Q1:
byte[] array
是类型为“ byte”的数组,通常称为“ byte array”。
Mind that byte
is an alias for System.Byte
. 注意该
byte
是System.Byte
的别名。 So you could come across Byte[]
, which will also be referred to as "byte array". 因此,您可能会遇到
Byte[]
,也将其称为“字节数组”。 ( Also mind, that this can be quite different in other languages like Java! ) (还要注意,这在其他语言(如Java)中可能会大不相同!)
Writes the stream contents to a byte array, regardless of the Position property.
不管Position属性如何,将流内容写入字节数组。
So given the MemoryStream's contents are the bytes mentioned, then yes, you would get a byte array with the bytes of q1. 所以给定MemoryStream的内容是提到的字节,那么是的,您将获得一个带有q1字节的字节数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.