I created a simple class that represents a project:
public class EntityAuftrag
{
public string cis_auftrag { get; set; }
public string bezeich { get; set; }
public DateTime? dStart { get; set; }
public DateTime? dEnd { get; set; }
public decimal? aufstunde { get; set; }
public int id_auftrag { get; set; }
public string barcolor { get; set; }
}
Now I have a list of these. I want to extract the smallest date, how do I do that?
You can use
Enumerable.Min(nullvalues will be ignored unless all values are null):Edit: if you want to find the object with the earliest(start) date, you can use
OrderByandFirst:If you want the latest date, you can use
Enumerable.OrderByDescendinginstead.