Snippets/Attribute/ValidateSet attribute.snippets.ps1xml
<?xml version='1.0' encoding='utf-8' ?>
<Snippets xmlns='http://schemas.microsoft.com/PowerShell/Snippets'> <Snippet Version='1.0.0'> <Header> <Title>ValidateSet attribute</Title> <Description>defines a ValidateSet attribute that you can use to decorate parameters and limit them to a selected set of valid choices.</Description> <Shortcut>[ValidateS</Shortcut> <Keywords>Attribute</Keywords> <Author>Tobias</Author> <DifficultyLevel>5</DifficultyLevel> <Example>False</Example> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> <Requirements> <MinimumPowerShellVersion>1</MinimumPowerShellVersion> <RequiredModules></RequiredModules> <AdminPrivileges>False</AdminPrivileges> <ProcessorArchitecture>x86,x64</ProcessorArchitecture> </Requirements> </Header> <Declarations> <Literal> <ID><![CDATA[14;7;0]]></ID> <Default></Default> <ToolTip><![CDATA[]]></ToolTip> <ToolTipStatusbar><![CDATA[Choice 1]]></ToolTipStatusbar> </Literal> <Literal> <ID><![CDATA[25;7;0]]></ID> <Default></Default> <ToolTip><![CDATA[]]></ToolTip> <ToolTipStatusbar><![CDATA[Choice 2]]></ToolTipStatusbar> </Literal> <Literal> <ID><![CDATA[36;7;0]]></ID> <Default></Default> <ToolTip><![CDATA[]]></ToolTip> <ToolTipStatusbar><![CDATA[Choice 3]]></ToolTipStatusbar> </Literal> </Declarations> <Code> <Script Language='PowerShell' CaretOffset='46'> <![CDATA[[ValidateSet('Choice1', 'Choice2', 'Choice3')]]]> </Script> </Code> </Snippet> </Snippets> |