CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2001
    Location
    Islamabad, Pakistan
    Posts
    113

    Serialization of class with dynamic arrays

    Hello!

    Im looking for examples of how to do Serialization of a class that has dynamic arrays. Im not sure what to write in the constructor of the Serializable class and in the GetObjectData function.

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    you could try storing as the XML Serialization file.

    Paresh
    - Software Architect

  3. #3
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    or giving sample,

    something like this,
    ------------
    string[] Str = new String[4]; // consider dynamic array
    for(int i=0; i<4; i++)
    {
    // initialize the array
    }

    XmlSerializer serializer = new XmlSerializer(typeof(strPath)); // some str

    FileStream stream = new FileStream("arr.txt",FileMode.Create);
    serializer.Serialize(stream, lp, null);
    stream.Flush();
    stream.Close();

    hope this helps,
    Paresh
    - Software Architect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured