I have a list with objects inside which have a DateTime
property.
Using a DataPicker
and a TimePicker
, I create a DateTime
object, which I then insert into the ObservableCollection<>
. However, I would like to insert the elements in the list in chronological order with respect to the DateTime
. How can I find the right position to put it in the list?
public class HumorDiary
{
public DateTime Dt { get; set; }
}
HumorDiary obj= new HumorDiary();
obj.Dt= xx/xx/xxxx;
ObservableCollection<HumorDiary> listDiario = new ObservableCollection<HumorDiary>();
listDiario.Insert(Position????, obj);