powershell max/first/aggregate functions

前端 未结 3 1106
日久生厌
日久生厌 2021-01-17 07:24

First of all, i`m .NET developer and LOVE LINQ and extension methods in C#. But when i scripting i need something equivalent to Enumerable extension methods

Can anyb

3条回答
  •  借酒劲吻你
    2021-01-17 07:55

    Keith correctly mentions PowerShell equivalents to some LINQ extension methods. Note that you can call most extension methods from PowerShell, you just can't invoke them like they are members.

    Extension methods are really just static methods with some extra rules in C# to allow them to be called like members.

    PowerShell doesn't implement any of those rules, but that doesn't stop you from calling them as static methods, e.g.

    [System.Linq.Enumerable]::Average([int[]](1..10))
    

提交回复
热议问题