I created a custom configuration section using the System.Configuration.ConfigurationSection class.
I'm have created a class that extends the ConfigurationElementCollectionClass - to represent a configuration element containing a collection of child elements.
The class works fine when retrieving values from the configuration file, but when I try to remote an object of this type, I get the following exception:
"You must implement a default accessor on
System.Configuration.ConfigurationLockCollection because it inherits
from ICollection."
In my class that extends ConfigurationElementCollection, I have the following accessor
public ManufacturerConfigurationElement this[int index]
{
get
{
return (ManufacturerConfigurationElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
Any ideas why I'm still receiving this exception?
Thanks,
https://www.experts-exchange.com/questions/21511144/You-must-implement-a-default-accessor-on-'SomeObjects'-because-it-inherits-from-ICollection.html
You need to put the "Default" keyword in your accessor.