8000 Enhance ValidateRange attributes · Issue #4477 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Enhance ValidateRange attributes #4477

@iSazonov

Description

@iSazonov

From #4084 (comment)

We could enhance and unify Ranges. Currently Min and Max values are allowed but user can want to exclude them. Ex., "Positive" exclude zero. So the "Positive" range looks:

ValidateRange(0, int.MaxValue, RangeOption.ExcludeMin)

"Negative":

ValidateRange( -int.MaxValue, 0, RangeOption.ExcludeMax)

Exclude both (allow 0.5):

ValidateRange( 0, 1, RangeOption.ExcludeMin+RangeOption.ExcludeMax)

And we can move switch (rangeKind) to a constructor (with assigning a specific error message) and implement general ValidateElement method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0