Hi everyone,

A very specific question..

I've got a ConfigurationElement class that has some configuration elements. At the moment, the config is something like this..

<Hello>
 <A name="blah" />
 <B name="bleh" />
 <C name="blih" />
</Hello>

..but I need to have only one of either B or C. So I should either have

<Hello>
 <A name="blah" />
 <B name="bleh" />
</Hello>

..or...

<Hello>
 <A name="blah" />
 <C name="blih" />
</Hello>

Any ideas if there's a nice way of doing this?

Hi,

You can throw Exception if both the elements are set by user while reading the value of elements, or I guess you can create your attribute to resolve this.

Thanks, I didn't think of the Attribute solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.