Gordon,

I cleanup this code up last week. It now will run validators on all types;
even on enums.

----- Original Message -----
From: "Gordon Weakliem" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 12, 2003 2:16 PM
Subject: Re: [nant-dev] Custom validators for enums


> This isn't a showstopper, just more of an observation.  I was confused
when I wrote a custom validator for an enum and was surprised when it didn't
get called.  Specifically, I was looking at demonstrating a custom validator
for the tutorial on the Wiki (writing a task to manipulate Windows
services), and I thought that I could use
System.ServiceProcess.ServiceControllerStatus to indicate what state you
wanted the service in after the operation completes.  In this case, the only
states that make sense are Running, Stopped, and Paused.  I hadn't thought
of creating a generic validator for any enum type, though that's an
interesting idea too.  I could go either way, but it should be documented
that validators don't get called for enums.
>
> Also, I noticed the code is doing Enum.Parse instead of
Convert.ChangeType, even though Enums implement IConvertible, and could
theoretically use Convert.ChangeType.  I tried changing Enum.Parse to
ChangeType just for grins and got an exception, probably doable but requires
more research to figure out.



-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to