title: power-shell retrieving line from array
body: <p>So if I create an array from CSV file </p>
  
  <pre><code>name,age,height,fruit
  Jon,34,5,orange
  Jane,23,4,apple
  Dave,27,6,pear
  </code></pre>
  
  <p>I can read this in using </p>
  
  <pre><code>$list = Import-CSV .....
  </code></pre>
  
  <p>but now i have the question. "tell me about Jane" </p>
  
  <p>So I could say </p>
  
  <pre><code>foreach ($val in $list)
  {
      if ($val.name = "jane" ) {$currentuser = $val}
  }
  
  write-host $currentuser.name
  write-host $currentuser.age
  write-host $currentuser.hight
  write-host $currentuser.fruit
  </code></pre>
  
  <p>Is there a better way to do this rather than stepping through? In my actually case i have a list of staff from HR and a separate one from Active directory.
  I want to step through the HR list to find the user in AD, set this user as a variable/object. and then update the user using information from HR. </p>
  
  <p>The above method will work but seems very inefficient to be loping through two lists of several thousand users. </p>
  
  <p>Given the array created from the CSV, I want a method that by inputting the string "jane" it will return jane's info to a object i can use. </p>