I am exploring what pipeline functionality is also available as methods. For example...
@('1', '2', '3', '2') | where {$_ -in @('2')}
will return the two '2'. But I can also do...
@('1', '2', '3', '2').Where({$_ -in @('2')})
and get the same result.
I also want to Group
, and while
@('1', '2', '3', '2') | group {$_.Count -gt 1}
doesn't do the actual grouping I want, it does... something. But
@('1', '2', '3', '2').Group({$_.Count -gt 1})
fails with Method invocation failed because [System.String] does not contain a method named 'Group'.
So that got me looking for what IS available as intrinsic methods.
@('1') | Get-Member -MemberType Method -Force | Format-Table
doesn't even include Where
and yet the Method is there. So I assume it is inheriting that method. But I don't know how to include inherited Methods. I though -Force
would do it but it doesn't, nor does -View
provide any more detail.
Is there a way to explore these intrinsic methods such as .Where()
? And perhaps tangentially, is there a way to Group as a method rather than with the pipeline?