I have a Single File And need to serialize multiple objects randomly. How can I in c#?

后端 未结 3 1739
被撕碎了的回忆
被撕碎了的回忆 2021-01-12 21:53

I have a single file and need to serialize multiple objects of the same class when ever a new object is created. I can\'t store them in arrays as I need to serialize them th

3条回答
  •  被撕碎了的回忆
    2021-01-12 22:33

    For every object that arrives, we will convert it into a Base64Encoded string and store it as one line in a text file. So, in this file, every row will have a serialized object per line. While reading we will read the file one line at a time and deserialize this Base64 encoded string into our Object. Easy.. so lets try out the code.

    http://www.codeproject.com/KB/cs/serializedeserialize.aspx?display=Print

提交回复
热议问题