Skip to content

Commit

Permalink
(AB#263705) Fix description for example using [ValidateScript()] (#…
Browse files Browse the repository at this point in the history
…11180)

Prior to this change, the example description in the article
_How to validate an argument using a script_ declared that
the example validates that the input belongs to a set of
possible values. That description belongs to a different
example, using `[ValidateSet()]`.

This change:

- Corrects the example description to match the code.
- Fixes AB#263705
  • Loading branch information
michaeltlombardi committed Jun 11, 2024
1 parent 6d5d3c5 commit 9288d35
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: How to validate an argument using a script
ms.date: 09/16/2021
ms.date: 06/11/2024
ms.topic: reference
title: How to validate an argument using a script
---
Expand All @@ -16,8 +16,8 @@ must return `$true` for every value piped to it.
## To validate an argument using a script

- Add the ValidateScript attribute as shown in the following code. This example specifies a set of
three possible values for the `UserName` parameter.
- Add the ValidateScript attribute as shown in the following code. This example specifies a script
to validate that the input value is an odd number.

```csharp
[ValidateScript("$_ % 2", ErrorMessage = "The item '{0}' did not pass validation of script '{1}'")]
Expand Down

0 comments on commit 9288d35

Please sign in to comment.