how to return DateTimeOffset with a Linq query.
I need to get a due date from a table of type DateTimeOffset
public DateTimeOffset GetLastDate(Guid Id, Guid AppId)
{
var q = from k in context.Inspections
where k.Id == Id || k.AppId == AppId
select k.Duedate;
return q;
}
cannot implicitly convert system.Linq.IQueryable to System.DateTimeOffset
The problem is that your query will return an
IQueryable<T>, with the type being the type ofDuedate.If
Duedateis aDateTimeOffset, you could return the first result (Where can return multiple matches) via: