I have this function that returns a reference type. Now, this function has two optional parameters both of which are instances of the DateTime
class. The function i
Btw, you don't have to use nullable datetime like all other answers says. You can do it with DateTime
as well:
public DateTime GetDate(
DateTime start = default(DateTime),
DateTime end = default(DateTime))
{
start = start == default(DateTime) ? DateTime.MinValue : start;
end = end == default(DateTime) ? DateTime.MinValue : end;
}
This is unlikely but it won't work as expected if you actually pass the default datetime value to your function.