简体   繁体   中英

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(); produce the same as question 1 or am I wrong.

If i am wrong how can i produce question 1 with question 2 or is it not possible?

Thank you

Q1: byte[] array is an array of type "byte" which is commonly referred to as "byte array".

Mind that byte is an alias for System.Byte . So you could come across Byte[] , which will also be referred to as "byte array". ( Also mind, that this can be quite different in other languages like Java! )

Q2: MSDN says:

Writes the stream contents to a byte array, regardless of the Position property.

So given the MemoryStream's contents are the bytes mentioned, then yes, you would get a byte array with the bytes of q1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM