title: LINQ SELECT FIRST ROW
body: <p>How can I select first row in a linq select statement without using foreach?</p>
  
  <p>I use foreach and then break; but it has to be a better way?</p>
  
  <p>I like to get the value in first row; plus check if no row is found.
  My problem is to get the value without foreach statement.</p>
  
  <p>What I do is to find a value in my DataTable and I know the row is uniqe; so I like to do a select and get the value; plus do a check if there is no hit to be safe... :)</p>
  
  <p>This is the code I use now, see below</p>
  
  <p>Thank you,
  Rune</p>
  
  <pre><code>var var_QUERY_linq = 
      from vm_TABLE_PK in vco_DataTable_PK.AsEnumerable()
      where vm_TABLE_PK.Field&lt;Int32&gt;( "MyField_Int32" ) == vmp_ROW_Counter_Int32
      select vm_TABLE_PK;
  
  foreach ( DataRow o_DataRow in var_QUERY_linq )
  {
         vmp_Return_string = o_DataRow.Field&lt;string&gt;( "Myfield_nvarchar" );
  
         break;
  }
  </code></pre>