I've written a LINQ query that should return an int value. but I'm not able to convert this value to int and an exception occured:
Unable to cast object of type 'QuickRoutes.DAL.RouteLinq' to type 'System.IConvertible'.
this is my LINQ :
var res = (from p in aspdb.RouteLinqs
orderby p.RouteId descending
select p).Take(1);
and the exception occures here:
route.Id =Convert.ToInt32(res.FirstOrDefault());
how can I solve this problem?