QOL Improvements for Classes #19969
Labels
Issue-Enhancement
the issue is more of a feature request than a bug
Needs-Triage
The issue is new and needs to be triaged by a work group.
WG-Engine
core PowerShell engine, interpreter, and runtime
Summary of the new feature / enhancement
I'd like to suggest a few small quality of live improvements to PowerShell Classes.
ValidateSet
orNotNullOrEmpty
[System.Collections.Arraylist[String]]
instead of[String[]]
to get a "Non IsFixedSize" version of it. The main annoyance currently is that.Add()
doesn't work when the listIsFixedSize
.[ValidateSet('string1', 'string2','string3')][string]$variable
with a proper type without requiring a bunch of custom serialization and deserialization code. So thatConvertTo-Json
andConvertFrom-Json
continue to work, but that proper types can be used for the attribute instead of having to check for the string value within the script.class T{ T() {}; T($name) {}}
breaks type casting if not implemented explicitely within that constructor. Currently the documentation only mentions the parameterless one, but not the one with a single parameter without a specified type (is this intentional or a bug?)$null =
and| Out-Null
in almost every line of such a function...[DefaultOut(Out-Null)] function Do-Something() { Do-Something -WithOutput; return "Only thing that is returned"}
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: