Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 973089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:13:38+00:00 2026-05-16T03:13:38+00:00

Here’s my code: [Serializable()] public class Project { private List<string> _Kinds = new List<string>();

  • 0

Here’s my code:

[Serializable()]
public class Project
{
    private List<string> _Kinds = new List<string>();
    public DataTable ExtractedElementsTable;

    public Project()
    {
        ExtractedElementsTable = new DataTable();
        ExtractedElementsTable.TableName = "Output";
    }

    public List<string> Kinds
    {
        get { return _Kinds; }
        set { _Kinds = value; }
    }
}

When, after adding some stuff to the List<string> _Kinds, I try to serialize the whole Poject, and then deserialize it, the _Kinds list is empty. But if I comment out all the three lines where ExtractedElementsTable is referenced, it works ok. Here’s is my serializing and deserializing code (note the currentProject.Kinds.Add("hi"); line in the serializing code. currentProject is just an instance of Project.

    private void openButton_Click(object sender, EventArgs e)
    {
        if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            Stream stream = File.Open(openFileDialog1.FileName, FileMode.Open);
            XmlSerializer xmlFormatter = new XmlSerializer(currentProject.GetType());
            currentProject = (Project)xmlFormatter.Deserialize(stream);
            stream.Close();
        }
    }

    private void saveButton_Click(object sender, EventArgs e)
    {
        if (saveFileDialog1.ShowDialog() == DialogResult.OK)
        {
            currentProject.Kinds.Add("hi");
            Stream stream = File.Open(saveFileDialog1.FileName, FileMode.Create);
            XmlSerializer xmlFormatter = new XmlSerializer(currentProject.GetType());
            xmlFormatter.Serialize(stream, currentProject);
            stream.Close();
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:13:38+00:00Added an answer on May 16, 2026 at 3:13 am

    Change the DataTable field to a DataSet field.

    I ran quite a few test. The Kinds property gets serialized with all the items. But does not deserialize properly. However, I changed the DataTable field to a DataSet and it all worked fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is my code, SiteMember class @OneToMany(mappedBy = member,cascade=CascadeType.ALL) private List<MemberThread> memberThread = new
Here is my class: public class A{ private void doIt(int[] X, int[] Y){ //change
Here is a code of a simple editor. public class editor { public static
Here is my serializable abstract class namespace NEN_FS { [Serializable()] abstract public class NFS
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here is the code I'm using inside my AsyncTask DefaultHttpClient httpClient = new DefaultHttpClient();
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
Here is the code from my project where I am using a datepicker. The
Here is the code: Function getData(ByVal id As String) Dim reader As SqlClient.SqlDataReader Dim

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.