PowerShell equivalent of LINQ Any()?

前端 未结 11 683
灰色年华
灰色年华 2020-12-01 03:29

I would like to find all directories at the top level from the location of the script that are stored in subversion.

In C# it would be something like this

         


        
11条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 04:00

    Unfortunately there is no equivalent in PowerShell. I wrote a blog post about this with a suggestion for a general purpose Test-Any function / filter.

    function Test-Any() {
        begin {
            $any = $false
        }
        process {
            $any = $true
        }
        end {
            $any
        }
    }
    

    Blog post: Is there anything in that pipeline?

提交回复
热议问题