perhaps I just don't understand streams as well as I should...

  • Thread starter Thread starter Lee Crabtree
  • Start date Start date
L

Lee Crabtree

Okay, maybe I'm trying to use streams in some unacceptable way, but I'm
running into a few problems.

I need to be able to serialize a set of data and deserialize it in
another place. It seems kind of pointless in one app, but since data
could come remotely, it's easiest to always serialize and deserialize in
the same place.

At the moment, I'm having trouble moving streams around. I need to be
able to have an object point to a stream for handling serializing an
object, and another object point to the same stream for deserializing
the object (at the moment, this is all proof-of-concept stuff).

Unfortunately, if I try and deserialize off of the same stream, I keep
getting errors about reading from the end of the stream. I understand
why that would happen, since the stream has written and is now at the
end of the stream. What I don't understand is how to deal with this.

Lee Crabtree
 
Lee,

After serializing into the stream revert the stream pointer.

You can do that eather useing the Position proeprty or using the Seek
method. Some of the streams cannot be sought; these are usually the streams
for net resources. If you now nothing about the stream you should check the
CanSeek property.
 
Okay, that's what I found initially, but I wasn't sure if there was a
better way to go about it all. Thanks.

Lee Crabtree
 

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