Cast problem with LINQ

Posted by yigit on Stack Overflow See other posts from Stack Overflow or by yigit
Published on 2010-04-13T12:09:20Z Indexed on 2010/04/13 12:13 UTC
Read the original article Hit count: 144

Filed under:
|
|

I'm tring to get my product's types to a list with Linq.

var types = (from t in NHibernateSession.Linq<Product>()
             select t.Type).Distinct().ToList<Type>();         
return types;

But its giving an Unable to cast object of type error

'...Domain.Product' to type '...Domain.Type'.

Please tell where am I going wrong.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ