K
Keller
Hello Group,
I posted this in microsoft.public.dotnet.general about a week ago but
haven't had any replies....
The Visual Studio 2005 help for
ConfigurationPropertyAttribute.DefaultValue
provides the following sample:
/////////////////////////////////////////////////
[ConfigurationProperty("maxIdleTime",
DefaultValue = "0:10:0",
IsRequired = false)]
[TimeSpanValidator(MinValueString = "0:0:30",
MaxValueString = "5:00:0",
ExcludeRange = false)]
public TimeSpan MaxIdleTime
{
get
{
return (TimeSpan)this["maxIdleTime"];
}
set
{
this["maxIdleTime"] = value;
}
}
/////////////////////////////////////////////////
What I am wondering is how does the DefaultValue parameter from the
sample code work, i.e.:
TimeSpan does not have a constructor or "=" operator that takes a
string parameter, and TimeSpan does not implement IConvertible. For
example, the following does not complile:
TimeSpan does have a Parse() method that takes a string parameter,
i.e.
but I do not see how it is associated in the above sample code.
So again how does this code from the sample work in regards to
assigning a string
DefaultValue to a TimeSpan value? i.e.:
My guess is TimeSpan.Parse() is somehow being called, but where?
TIA,
Keller Beyer
(e-mail address removed)
I posted this in microsoft.public.dotnet.general about a week ago but
haven't had any replies....
The Visual Studio 2005 help for
ConfigurationPropertyAttribute.DefaultValue
provides the following sample:
/////////////////////////////////////////////////
[ConfigurationProperty("maxIdleTime",
DefaultValue = "0:10:0",
IsRequired = false)]
[TimeSpanValidator(MinValueString = "0:0:30",
MaxValueString = "5:00:0",
ExcludeRange = false)]
public TimeSpan MaxIdleTime
{
get
{
return (TimeSpan)this["maxIdleTime"];
}
set
{
this["maxIdleTime"] = value;
}
}
/////////////////////////////////////////////////
What I am wondering is how does the DefaultValue parameter from the
sample code work, i.e.:
TimeSpan does not have a constructor or "=" operator that takes a
string parameter, and TimeSpan does not implement IConvertible. For
example, the following does not complile:
TimeSpan does have a Parse() method that takes a string parameter,
i.e.
but I do not see how it is associated in the above sample code.
So again how does this code from the sample work in regards to
assigning a string
DefaultValue to a TimeSpan value? i.e.:
My guess is TimeSpan.Parse() is somehow being called, but where?
TIA,
Keller Beyer
(e-mail address removed)