C# convert Datatable to class
<p>I am trying to convert a Datatable to a c# class.</p>

<p>I am using the following method to convert
this i developed as a console application. I have not referenced  entity framework on console application.</p>

<pre><code>**Class1**  items = dt.AsEnumerable().Select(row =&gt;
   new Class1
   {
       id = row.Field&lt;string&gt;("id"),
       name = row.Field&lt;string&gt;("name")
   }).FirstOrDefault();
</code></pre>

<p>when i implied this code to my real time project</p>

<p>I am getting the following error</p>

<p><strong>The type 'System.Data.Objects.DataClasses.IEntityWithKey' is defined in an assembly that is not referenced.</strong></p>

<p>I do not want to refer entity frame work and in my console application i have not referenced any thing.It is working perfectly. why i am getting this error in my real time project</p>

<p>Is there any other way to convert datatable to c# class.</p>

<p>My application is in c# ,visual studio 2008 console application.</p>

<p>error is showing in Class1
Console and real time project are in vs 2008</p>
