howdy y’all,
i’m curious to know if it would make sense to post an enhancement request for powershell to allow something like …
[ValidateNotNollOrEmpty()]$Variable
… in normal code in addition to in the Param
section of a function.
i’m aware there are ways to get similar results with [string]::IsNullOrEmpty()
, but my personal take is that the validate stuff seems more direct. more self documenting. more posh-like, even. [grin]
so, opinions anyone?
take care,
lee
-ps
so it DOES work, kinda. requires an assignment to trigger it and it produces a big red error msg.
what i was wanting was something that could be used in an IF test that would return a $True/$False boolean.
would that be worth an enhancement request?
lee-
submitted by /u/Lee_Dailey
[link] [comments]
The post is there a reasonable use case for extending the “Validate*” stuff to use them with variables? appeared first on How to Code .NET.