Q:

Check if ConfigurationProperty value is not set

Let's say I have a ConfigurationProperty defined this way:
[ConfigurationProperty("TheProp")]
public double TheProp
{
    get{//some code}
    set{//some code}
}

How do I check if this ConfigurationProperty has a value or not? DefaultValue will not work in this case, because any double value is a valid value for the configuration property.

A:

You could try making the type of the property 'Nullable':
[ConfigurationProperty("TheProp")]
public double? TheProp
{
    get{//some code}
    set{//some code}
}

This will allow you to test for if(TheProp.HasValue).

