I have the following class:
public class MyClass
{
public DateTime? Date1 { get; set; }
public DateTime? Date2 { get; set; }
}
Objects from this class always have one of those dates in null, and the other with a value, for example:
var obj1 = new MyClass
{
Date1 = new DateTime(2020/12/12),
Date2 = null
};
var obj2 = new MyClass
{
Date1 = null,
Date2 = new DateTime(2020/12/8)
};
var obj3 = new MyClass
{
Date1 = new DateTime(2020/12/24)
Date2 = null
};
Is there a way in which i can get the ordered data from my database context by those two properties? (Probably merging the two columns while doing the query, but then i don't want the output to have that merged column)
In this case the query should give the following result: [obj2, obj1, obj3]