I am writing a custom PowerShell cmdlet and I would like to know what is the correct way to validate a parameter.
I thought this could be done either in the accessory of the property set, or during the execution of the cmdlet:
[Cmdlet(VerbsCommon.Add,"X")] public class AddX : Cmdlet { private string _name; [Parameter( Mandatory=false, HelpMessage="The name of the X")] public string name { get {return _name;} set {
What is the "standard" approach? Property collection, ProcessRecord or something completely different?
source share