title: How to Get the Values from DataRow using Row Name
body: <p>I have a Table with following format :</p>
  
  <pre><code>Name                  Value
  ------------------------------- 
  IsFirst           0
  skateType         0
  IsApplied         1
  </code></pre>
  
  <p>I have a Class <code>DetailsClass</code> and need to update it's object based on the value from table.</p>
  
  <pre><code>public class DetailsClass
      {
          [DataMember]
          public bool IsFirst { get; set; }
  
          [DataMember]
          public bool skateType { get; set; }
  
          [DataMember]
          public bool IsApplied { get; set; }
      }
  </code></pre>
  
  <p>For now I am doing :</p>
  
  <pre><code> foreach (DataRow row in dataTable.Rows)
                  {
                      if (String.Equals(row["Name"].ToString(), "IsFirst"))
                          VDetail.Base = dataTable.Rows[0]["Value"] != null ?   Convert.ToBoolean(dataTable.Rows[0]["Value"]) : false;
  
                      else if (String.Equals(row["Name"].ToString(), "skateType"))
                          VDetail.Type = dataTable.Rows[1]["Value"] != null ? Convert.ToBoolean(dataTable.Rows[0]["Value"]) : false;
  
                      else if (String.Equals(row["Name"].ToString(), "IsApplied"))
                          VDetail.IsApplied = dataTable.Rows[2]["Value"] != null ? Convert.ToBoolean(dataTable.Rows[0]["Value"]) : false;
                  }
  </code></pre>
  
  <p>But is there a better way of doing it?</p>