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.  
  
-----Original Message----- 
  
I don't think the result is confusing, but what type of validator would you 
want to run? I guess it is possible that a future EnumValidatorAttribute 
would limit the enum to only a few values. 
  
Can you describe a usage scenario? (or are you just commenting on how things 
should be?) 
  
----- Original Message ----- 
From: "Gordon Weakliem" <[EMAIL PROTECTED]> 
  
> Looking at SourceForge.NAnt.Element.InitializeAttributes(XmlNode), 
attributes backed by a property of type Enum don't have their validators 
run. My thinking is that you might use an existing enum type for 
convenience, but you'd want to further restrict the range of values that 
could be passed to your task. Or is that too confusing? 
  
  
------------------------------------------------------- 
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod: 
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en 
_______________________________________________ 
Nant-developers mailing list 
[EMAIL PROTECTED] 
https://lists.sourceforge.net/lists/listinfo/nant-developers 


-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to