iam new in linq, i want to convert linq result to dictionary, but i get an error.
this is my c# code :
var q = from abs in db.TT_ABSENCEs join emp in db.TT_EMPLOYEEs on abs.Employee_NIP equals emp.Employee_NIP where Convert.ToDateTime(abs.ReceivedTime).Day == DateTime.Now.Day && Convert.ToDateTime(abs.ReceivedTime).Month == DateTime.Now.Month && Convert.ToDateTime(abs.ReceivedTime).Year == DateTime.Now.Year select new { abs.ReceivedTime, abs.Employee_NIP, abs.AbsenceTime, abs.GeoLoc, abs.statusAbsence, emp.Employee_Name }; Dictionary<String, TT_ABSENCE> _dict = q.ToDictionary(abs => abs.Employee_NIP, abs => abs.statusAbsence); this is my error :
Cannot implicitly convert type '
System.Collections.Generic.Dictionary<string,AnonymousType#1>' to 'System.Collections.Generic.Dictionary<string,DataAccess.TT_ABSENCE>'
how to convert linq result to dictionary?
select new { abs.ReceivedTime, abs.Employee_NIP, abs.AbsenceTime, abs.GeoLoc, abs.statusAbsence, emp.Employee_Name }with thisselect abs