Posted on: 9/10/2015 6:13:08 PM | Views : 812

I have an Interface and a class that implements this interface.
Im trying to return a null if no dates are found
Code from Interface
List<DateTime> GetDates(); Class
public List<DateTime> GetDates() { IEnumerable<DateTime> CurrentDates = GetSomeData; if (CurrentDates != null && CurrentDates.Count() > 0) { do something.... } return CurrentDates.ToList(); } The above code works fine until the returned CurrentDates is null then i get an error "Object value cannot be null"
I tried adding ? to the function to make it nullable but couldnt get it to work as i expected and instead got the error
List<DateTime>' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method ...

Go to the complete details ...