I have the following classes
[Serializable()]
public class ColumnList
{
public ColumnList()
{
ListOfColumns = new List<Column>();
}
public ColumnList(string name)
: this()
{
Name = name;
}
List<Column> ListOfColumns { get; set;}
public string Name { get; set; }
//Extra methods cut out.
}
[Serializable()]
public partial class Column
{
public Column()
{
VarName = "";
HeaderName = "";
ItemType = "";
SelectText = "";
Position = 0;
Visable = true;
}
public Column(string varName, string headerName, string itemType, string selectText, int position)
{
VarName = varName;
HeaderName = headerName;
ItemType = itemType;
SelectText = selectText;
Position = position;
Visable = true;
}
public string VarName { get; set; }
public string HeaderName { get; set; }
public string ItemType { get; set; }
public string SelectText { get; set; }
public int Position { get; set; }
public bool Visable { get; set; }
//extra methods cut out.
}
With the following in my Settings.cs file
[global::System.Configuration.UserScopedSettingAttribute()]
public List<ColumnList> ColumnListLists
{
get { return ((List<ColumnList>)(this["ColumnListLists"])); }
set { this["ColumnListLists"] = value; }
}
So basically I have a list of a class, that class contains a name and a list of another class. That class has a several strings, a boolean, and a int.
However after my program runs my user.config has this in it.
<value>
<ArrayOfColumnList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ColumnList>
<Name>Preproduction</Name>
</ColumnList>
<ColumnList>
<Name>Production</Name>
</ColumnList>
<ColumnList>
<Name>Contract Approval</Name>
</ColumnList>
</ArrayOfColumnList>
</value>
It has the name of the ColumnList
but it does not contain the Column
elements. Any suggestions on what I am doing wrong?