user8639393
user8639393

Reputation: 17

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

Upvotes: 0

Views: 53

Answers (1)

Fildor
Fildor

Reputation: 16104

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.

Upvotes: 2

Related Questions