Avatar of epicdevelopers
epicdevelopersFlag for United States of America

asked on 

.NET Custom Configuration Section

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,
C#.NET ProgrammingASP.NET

Avatar of undefined
Last Comment
epicdevelopers
Avatar of Alfred A.
Alfred A.
Flag of Australia image

Avatar of Alfred A.
Alfred A.
Flag of Australia image

Oh I didn't notice it is C#, you have already the indexer equivalent for "Default" VB.NET keyword.  Sorry.
Avatar of Alfred A.
Alfred A.
Flag of Australia image

Check the comments in this link.  This might help.

http://www.dotnet247.com/247reference/msgs/13/66184.aspx
ASKER CERTIFIED SOLUTION
Avatar of epicdevelopers
epicdevelopers
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of epicdevelopers
epicdevelopers
Flag of United States of America image

ASKER

.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo