title: Converting ISingleResult List values to my class without Looping
body: <p>I have asked this question already ("converting/Casting ISingleResult - List values to my class without Looping") but I didin't give a correct example. so I'm repeating the same question with a correct example:</p>
  
  <p>I have a DataContract like this:</p>
  
  <pre><code>[Serializable]
  [DataContract]
  public class Employee
  {
      public Employee()
      {
      }
      [DataMember]
      public string Name { get; set; }
      [DataMember]
      public int EmpId { get; set; }
      [DataMember]
      public List&lt;EmpMonthSal&gt; EmpMonthlySal { get; set; }
  }
  
  public class EmpMonthSal
  {
      public EmpMonthSal()
      {
  
      }
  
      [DataMember]
      public int EmpId { get; set; }
      [DataMember]
      public int Month { get; set; }
      [DataMember]
      public float Sal { get; set; }
  }
  </code></pre>
  
  <p>And I'm using Linq to Sql in my c# app which creates the below code:</p>
  
  <pre><code>[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.GetEmployeeDetails"
  )]public ISingleResult&lt;GetEmployeeDetailsResult&gt; 
  GetEmployeeDetails([global::System.Data.Linq.Mapping.ParameterAttribute(Name=
  "EmpId", DbType="NVarChar(32)")] string empID){IExecuteResult result =
  this.ExecuteMethodCall(this, ((MethodInfo)   (MethodInfo.GetCurrentMethod()))
  , empID);return ((ISingleResult&lt;GetEmployeeDetailsResult&gt;)(result.ReturnValue));
  }
  </code></pre>
  
  <p>And the auto generated GetEmployeeDetailsResult class looks like this:</p>
  
  <pre><code>public class GetEmployeeDetailsResult
  {
      public GetEmployeeDetailsResult()
      {
      }
  
      public string Name { get; set; }
      public int EmpId { get; set; }
      public int month { get; set; }
      public float sal { get; set; }
  }
  </code></pre>
  
  <p>I'm converting the ISingleResult result of GetEmployeeDetailsResult to a List and I'm getting something like this:</p>
  
  <pre><code>Empname  EmpID     Month      Salary
  
  Raja    1   1   8000
  
  Raja    1   2   8000
  
  Raja    1   3   8000
  
  Raja    1   4   7800
  
  Raja    1   5   7800
  
  Raja    1   6   7800
  
  Raja    1   7   7800
  
  Raja    1   8   7800
  
  Raja    1   9   7800
  
  Raja    1   10  7800
  
  Raja    1   11  7800
  
  Raja    1   12  90000
  
  Kumar   2   1   200000
  
  Kumar   2   2   200000
  
  Kumar   2   3   200000
  
  Kumar   2   4   200000
  
  Kumar   2   5   200000
  
  Kumar   2   6   200000
  
  Kumar   2   7   200000
  
  Kumar   2   8   200000
  
  Kumar   2   9   195000
  
  Kumar   2   10  200000
  
  Kumar   2   11  198000
  
  Kumar   2   12  200000
  </code></pre>
  
  <p>I want to map this flat List back to an object of Employee class. I don't want to loop through the List and create object for each class. </p>
  
  <p>Is there any other way like writing a linq query again or anything else really smart.</p>
  
  <p>Please give you suggestions.</p>