title: C# Traverse expression tree to extract table names
body: <p>I need a way to traverse a LINQ-to-SQL expression tree to extract the table name(s) in the query.  Even just the first table used in the query would probably be sufficient.</p>
  
  <p>Example:</p>
  
  <pre><code>var query = from c in Db.Customers select c;
  </code></pre>
  
  <p>And the ideal function:</p>
  
  <pre><code>string TableName = ExtractTablesFromQuery(query);
  </code></pre>
  
  <p>Would return string "Customers"</p>