KEMBAR78
Adding PS* aliases for Where|Foreach magic methods by powercode · Pull Request #25511 · PowerShell/PowerShell · GitHub
Skip to content

Conversation

@powercode
Copy link
Collaborator

PR Summary

#25432

PR Context

Adds PSWhere and PSForEach methods to the binder as aliases for the Where and Foreach magic methods.

This works around the issue on List<T> where a ForEach method is defined that hides the magic method.

PR Checklist

@powercode powercode force-pushed the ps_where_foreach branch 2 times, most recently from 3efafd6 to 1641ec2 Compare May 5, 2025 21:58
@powercode powercode added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label May 5, 2025
@powercode powercode force-pushed the ps_where_foreach branch from 1641ec2 to 06e052f Compare May 5, 2025 22:03
@powercode
Copy link
Collaborator Author

$list = [System.Collections.Generic.List[int]]::new([int[]]@(1..10))
$list.PSForEach{$_}
1
2
3
4
5
6
7
8
9
10

@powercode
Copy link
Collaborator Author

@daxian-dbw Sorry for the messy PR - should be good for review now.

@powercode powercode force-pushed the ps_where_foreach branch from 1b79373 to 98f4ebd Compare May 5, 2025 22:27
@daxian-dbw
Copy link
Member

/azp run PowerShell-CI-linux-packaging, PowerShell-Windows-Packaging-CI

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@daxian-dbw daxian-dbw merged commit 9cbbb8f into PowerShell:master May 6, 2025
36 checks passed
@github-project-automation github-project-automation bot moved this from PR In Progress to Done in PowerShell Team Reviews/Investigations May 6, 2025
@microsoft-github-policy-service
Copy link
Contributor

microsoft-github-policy-service bot commented May 6, 2025

📣 Hey @@powercode, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

Development

Successfully merging this pull request may close these issues.

2 participants