Entity to class

Posts   
 
    
Newer
User
Posts: 8
Joined: 25-Sep-2012
# Posted on: 28-Sep-2012 21:18:15   

I am trying to convert the typedListClass resultset to List< class>.

OrderLinqTypedList orderCustomerEmpShip = new OrderLinqTypedList();
orderCustomerEmpShip.Fill(0, sorter, true, filter);

List<Temp> myClass = orderCustomer.ToList();

Getting error: Cannot implicitly convert type 'System.Collections.Generic.List<NorthwindDAL.TypedListClasses.OrderLinqRow>' to 'System.Collections.Generic.List<WinApp.Temp>'

Please let me know is there any easy way put the data from typed list class to generic list<class>.

I tried with linq to entities like this as well.

  IEnumerable<string> records = from entity in orderCustomerEmpShip
                                          select new
                                          {
                                              Prop1 = entity.CustomerId,
                                              Prop2 = entity.FirstName
                                          };

And The error message is: Cannot implicitly convert type 'System.Collections.Generic.List<AnonymousType#1>' to 'System.Collections.Generic.List<string>'

Please share a code snippet for me. Thanks!

Newer
User
Posts: 8
Joined: 25-Sep-2012
# Posted on: 28-Sep-2012 22:50:19   

I fixed it, Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Sep-2012 06:57:05   

Newer wrote:

I fixed it, Thanks

Haha, good! simple_smile that was quick.

David Elizondo | LLBLGen Support Team