1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question about Serialized Objects and file streams

Discussion in 'C#' started by argv, Sep 6, 2010.

  1. argv

    argv New Member

    Sep 6, 2010
    Likes Received:
    Trophy Points:

    I'm pretty new to C#, just learning it on my own from what I know between Java and C++/C. The term "serialization" is new to me, although I know what it means.

    I'm making a small program that simply takes some daily log information about some daily happenings, and writes them to a (binary) file, which can later be opened and viewed via a listbox on the bottom of the form.

    Here is my question:

    I assume that the "deserialize" method de-serializes the WHOLE stream. I want to break it into chunks that are the size of my class (like you would in C or C++), so I can write each individual entry down.

    However, in C++ you would use the reinterpret_cast(&instance), sizeof(object) to tell the program the size of "chunk" you want. C# doesn't appear to have that going on, and I haven't found anything that helps yet online. (I'm searching even as I'm writing this). How would I accomplish this "chopping up" of my data stream in c#?

    thank you in advance, and have a great day! :)


Share This Page