title: max function in linq
body: <p>i want receive max parentID in menu table with linq. i use this code:</p>
  
  <pre><code>var orderMenu = (from M in conn.Menus.ToList()
                                      where M.ParentID == _type
                                      select M.ParentID).Max();
  </code></pre>
  
  <p>but display error:</p>
  
  <pre><code>Sequence contains no elements
  </code></pre>
  
  <p>(The table may be empty)</p>