title: FileHelpers reading string array from object array
body: <p>The problem I'm having is trying to read the the string array from the object array that is produced from the FileHelpers class.</p>
  
  <p>This is my File Helpers class code:</p>
  
  <pre><code>[DelimitedRecord(",")]
  public class test
  {
      [FieldDelimiter(":")]
      public string header;
  
      public string[] phStrArray;
  }
  </code></pre>
  
  <p>Then I try getting the fields from the object</p>
  
  <pre><code>string line="pie,cherry,berry:,cake,carrot,vanilla";
  FileHelperEngine engine= new FileHelperEngine(className);
  var test =engine.ReadString(line);
  Object myObject = test[0];
  FieldInfo[] fields = className.GetFields();
  var objTempValue = fields[1].GetValue(myObject);
  tempValue += Convert.ToString(objTempValue);
  </code></pre>
  
  <p>And that will work great for the regular string variable, but when it comes to the string array it will just return "System.String[]". Overall I'm just not sure how to read that string array into a string or make it an actual string array I can actually grab data from. I have a feeling I'm over thinking on how to get data from it. </p>
  
  <p>Thanks for the help in advance.</p>
  
  <p>Edit: Forgive me, I should of wrote that a little clearer(That's what I get for using var). The problem is the variable objTempValue turns into a type of Object{string[]}. So it's like the object is holding a string array and there doesn't seem to be a way to get to it. That's the variable I need to convert to string or get data from.</p>
  
  <p>Update: Another way to do this is to cast it to a string array like so.</p>
  
  <pre><code>string[] arr = ((IEnumerable&lt;object&gt;)objTempValue).Cast&lt;object&gt;()
                                                    .Select(x =&gt; x.ToString())
                                                    .ToArray();
  </code></pre>
  
  <p>I'm not entirely sure what option is better, but both this and the answer seem to work quiet well.</p>