Problem:
I was creating a custom Webpart to display item which comes into range of start date(user input) and end date(user input), but actual problem was that how I define a LINQ query so if user not input start date or end date then also my query should work without executing that particular where clause.
Solution:
var listItems =
(from SPListItem item in lst.Items
where
(startDate == null || Convert.ToDateTime(item["StartDate"]) >= startDate) && (endDate == null || Convert.ToDateTime(item["EndDate"]) <= endDate)
select item
.Distinct()
.ToList();