Simple performance increases in 'Invoke-WPFTab' function - Use where method instead of piping the result into Where-Object

This commit is contained in:
Mr.k 2024-10-25 13:12:59 +03:00
parent f98d3be85e
commit c0e8a14c8e
No known key found for this signature in database

View File

@ -19,7 +19,7 @@ function Invoke-WPFTab {
$tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
$filter = Get-WinUtilVariables -Type ToggleButton | Where-Object {$psitem -like "WPFTab?BT"}
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
($sync.GetEnumerator()).where{$psitem.Key -in $filter} | ForEach-Object {
if ($ClickedTab -ne $PSItem.name) {
$sync[$PSItem.Name].IsChecked = $false
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1