We can use the single line if statement c# .net. The below given example is might help you.
This is the Default query as given below
(if) ? then : else
Check the month using single line if in c# .net as given below
This is the Default query as given below
(if) ? then : else
Check the month using single line if in c# .net as given below
result = (month == 1) ? "Jan" : DateTime.Now();