Linq Question Team
I have a problem with LINQ and I was hoping someone could explain to me why. I have this code:
List<Spec> specs = GetSpecs(userObject, seasonID, partnershipID);
var query = from s in specs
where (DateTime)s.FinalApprovedDate != null
&& !((DateTime)s.FinalApprovedDate).Equals(DateTime.Parse("1/1/1900 12:00:00 AM"))
group s by s.ForCompanyID into g
select new
{
Vendor = g.Key,
Avg = g.Average(s.FinalApprovedDate.Subtract((DateTime)s.Created_Date).Days)
};
What I would like to extract from this request is the average difference between the days between the generated date and the final confirmed date for each Company represented in ForCompanyID, where the dates are not null or "1/1/1900". My problem is that I cannot figure out how to get this data from this request. From what I've read, I believe this is the correct syntax, but I get "Name" in the current context does not exist in the new values. I've also tried it with g here, but that doesn't matter. Any thoughts?
+1
a source to share