I had to create a custom configuration section for my library. One of the parameters in the configuration should be positive double. However, for some reason I could not find any Validator for double.
For instance, here's how I use the integer validator:
[ConfigurationProperty("someProp", IsRequired = false, DefaultValue = 15)]
[IntegerValidator(MaxValue = 200, MinValue = 0)]
public int SomeProperty
{
get
{
return (int)this["someProp"];
}
set
{
this["someProp"] = value;
}
}
I've looked through Google and was not able to find any mention of DoubleValidator or FloatValidator. Is it possible to somehow make sure the property is a positive double? Are there any reasons DoubleValidator is not present in the System.Configuration? Maybe I am mistaken and double properties should not be stored in the config file.