Skip to content

Implement Class Accessors #21079

Open
Open

Description

@iRon7

Summary of the new feature / enhancement

Continuing from (reopening) the #2219 issue as this enhancement request is still valid and was actually already in a Up-for-Graps state (also part of: #6418 and #6652).

Proposed technical implementation details (optional)

In awaiting for a formal PowerShell Class Accessors implementation that could be added to e.g. the Wikipedea mutator example list, I have created a Use-ClassAccessors cmdlet patch to update accessors according to the suggestion from JohnFAsh discussed in the related issue Properties with accessor and mutator methods.
Note that in this patch/workaround, I deferred from the "agreed"? syntax and used the suggested get_<property name>/set_<property name> propose from JohnFAsh mainly because this syntax is downwards compatible with the current - and older versions of (Windows) PowerShell that support classes.
See also: Is it possible to override the Getter/Setter functions in a powershell 5 class?

Activity

  1. added
    Issue-Enhancement
    Needs-Triage
    on Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementNeeds-Triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions