title: What is the PowerShell equivalent of LINQ's All()?
body: <p>I'm trying to test if a condition is true for all items in an array in PowerShell (similarly to LINQ's <code>All</code> function). What would be the 'proper' way to do this in PowerShell, short of writing a manual for-loop?</p>
  
  <p>To be specific, <a href="https://stackoverflow.com/a/35258044/4077294">here</a> is the code I'm trying to translate from C#:</p>
  
  <pre><code>public static IEnumerable&lt;string&gt; FilterNamespaces(IEnumerable&lt;string&gt; namespaces)
    =&gt; namespaces
       .Where(ns =&gt; namespaces
         .Where(n =&gt; n != ns)
           .All(n =&gt; !Regex.IsMatch(n, $@"{Regex.Escape(ns)}[\.\n]")))
       .Distinct();
  </code></pre>