I have an object that looks like this:
public class MyObject
{
public Nullable<DateTime> SpecificDate {get;set;}
....other properties
}
I’m writing a dynamic query that receive this object as a parameter and where I may or may not need the SpecificDate:
if (condition){
TheQuery = from....
where x.AppointDate.Date == TheObject.SpecificDate.Date
}
However, when I write TheObject.SpecificDate. I’m not getting the intellisense to choose the .Date property.
Any idea why?
Thanks.
You need to write
TheObject.SpecificDate.Value.Date.However, be careful because if the date is
nullthis will throw. You might want to check thatTheObject.SpecificDate != nullfirst.