Ahmad,
Can you post your code with an example?
I would ^think^ that there would be a marker that the serialization
engine sets for the end of the serialized object, so that you can serialize
one object after another from the same stream. However, from what I
remember, there are no guarantees that is in fact what it does.
What you could do is serialize to a temp stream (MemoryStream) and then
prefix whatever you write to your final stream with the length. You can
then read the length, then read the characters out to a byte array which you
construct a MemoryStream from and then deserialize your instance from.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Ahmad Jalil Qarshi" <ah*********@SPAMhotmail.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
Hi!
I have a class named CClassToSerialize that contain some boolean, string
and few custom variable types.
Now when I create only a single Object and Serialize/Deserialize
everything is fine.
But I want to save more than one Object of this class into same file.
Now the problem is that if I create first object and Serialize it after
initializing some variables. Size of file is 905 bytes. Again when I
create another object of the same class and Serialize it after
Initializing same variables but with different values the size of the file
becomes 1,799 bytes. which is not double of 905.
Now I dont know how to Deserialize each object independently.
So anybody there to help me how to achieve this task.
Thanks in Advance
Ahmad Jalil Qarshi