Byte[]

  • Thread starter Thread starter Michel Racicot
  • Start date Start date
M

Michel Racicot

What is the best way to read datas in a byte[] that contains several
datatypes?

Some of the datas needs to be peeked before being read, so I can't use
anything that advances while reading without permitting peeking any number
of bytes first...

Normally, I would have used a StreamReader but it seems that it cannot peek
for more than 1 byte...

Any suggestions?
 
I don't understand the question. There's no such thing as peeking into a
byte array. You can read it backewards and forwards any which way you want.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A brute awe as you,
a Metallic hag entity, eat us.
 
Michel,
As Kevin indicated, a byte array is an array of bytes. You can choose which
element to start reading at and read as many elements as you wish just like
any other array.
I suspect you may be confusing this the the different datatypes that might
be serialized via a struct such as with LayoutKind.Sequential where the
number of bytes and type for each field in the struct is clearly demarcated.

Hope that helps.
Peter
 
Please expand your question a bit.

--
William Stacey [MVP]

| What is the best way to read datas in a byte[] that contains several
| datatypes?
|
| Some of the datas needs to be peeked before being read, so I can't use
| anything that advances while reading without permitting peeking any number
| of bytes first...
|
| Normally, I would have used a StreamReader but it seems that it cannot
peek
| for more than 1 byte...
|
| Any suggestions?
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top