I am serializing a class and I get the following exception:
You must implement a default accessor on System.Configuration.SettingsPropertyCollection because it inherits from ICollection.
when the following line is executed:
XmlSerializer xs = new XmlSerializer(typeof(CustomConfiguration));
Any help?
public class CustomConfiguration : ConfigurationObjectBase
{
public CustomConfiguration () { //DO NOTHING. }
[User]
public uint Version
{ get { return ((uint)(this["Version"])); }
set { this["Version"] = value; }
}
}
ConfigurationObjectBase is derived from System.configuration.ApplicationSettingsBase.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…