beantownace
Active member
- Joined
- Feb 15, 2019
- Messages
- 26
- Programming Experience
- 5-10
Is this best way to set a nullable DateTime? for a object where I either have a order date of today or tomorrow then I set a date otherwise I need it to just be null.
code:
var order = new OrderSetup
{
Customer = Customer,
Total = Total,
OrderDate = string.Compare(OrderStatus, "Today", StringComparison.OrdinalIgnoreCase) == 0 ?
Dates.TodayOrderDate :
string.Compare(OrderStatus, "Tomorrow", StringComparison.OrdinalIgnoreCase) == 0 ?
Dates.TommorrowOrderDate : (DateTime?)null //is this the best way where it seems like I have to set this as a nullable datetime.
};