Home All Groups Group Topic Archive Search About

Custom Configuration Section Help

Author
19 Nov 2007 9:01 PM
Yan Yi Huang
Hi everyone,

I have created a custom configuration section which contains an optional
configuration element.  When I retrieve the custom configuration section, I
also get an instance of the nested configuration element even when I don't
have it inside the custom configuration section.  Need help figuring out how
to have null value for the optional configuration element when it is not in
the configuration section.

I have no problem retrieving the section:

<customConfig>
    <customElement value="blah"/> <!-- optional and can be missing
sometimes -->
</customConfig>

Would like to have null when I call customerConfig.customElement with the
following config:

<customConfig>
</customConfig>

Currently, calling customerConfig.customElement returns an instance of
customElement with the attribute value="".

Any help will be appreciated.

Yan Yi

Author
22 Nov 2007 11:39 AM
Alexander Vasilevsky
Try to change default value of customerConfig.customElement

http://www.alvas.net  - Audio tools for C# and VB.Net developers


Show quote
"Yan Yi Huang" <yanyhu***@verizon.net> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ: news:e1Mut9uKIHA.5580@TK2MSFTNGP02.phx.gbl...
> Hi everyone,
>
> I have created a custom configuration section which contains an optional
> configuration element.  When I retrieve the custom configuration section,
> I also get an instance of the nested configuration element even when I
> don't have it inside the custom configuration section.  Need help figuring
> out how to have null value for the optional configuration element when it
> is not in the configuration section.
>
> I have no problem retrieving the section:
>
> <customConfig>
>    <customElement value="blah"/> <!-- optional and can be missing
> sometimes -->
> </customConfig>
>
> Would like to have null when I call customerConfig.customElement with the
> following config:
>
> <customConfig>
> </customConfig>
>
> Currently, calling customerConfig.customElement returns an instance of
> customElement with the attribute value="".
>
> Any help will be appreciated.
>
> Yan Yi
>
>

AddThis Social Bookmark Button