title: Array.Find and IndexOf for multiple elements that are exactly the same object
body: <p>I have trouble of getting index of the current element for multiple elements that are exactly the same object:</p>
  
  <pre><code>$b = "A","D","B","D","C","E","D","F"
  $b | ? { $_ -contains "D" }
  </code></pre>
  
  <p>Alternative version:</p>
  
  <pre><code>$b = "A","D","B","D","C","E","D","F"
  [Array]::FindAll($b, [Predicate[String]]{ $args[0] -contains "D" })
  </code></pre>
  
  <p>This will return:
  D
  D
  D</p>
  
  <p>But this code:</p>
  
  <pre><code>$b | % { $b.IndexOf("D") }
  </code></pre>
  
  <p>Alternative version:</p>
  
  <pre><code>[Array]::FindAll($b, [Predicate[String]]{ $args[0] -contains "D" }) | % { $b.IndexOf($_) }
  </code></pre>
  
  <p>Returns:</p>
  
  <p>1
  1
  1</p>
  
  <p>so it's pointing at the index of the first element. <strong>How to get indexes of the other elements?</strong></p>