I've tried:
Persons = from i in Persons orderby i.Age select i;
But I cant convert Linqs System.Linq.IOrderedEnumerable
to ObservableCollection<Person>
.
You just need to create a new instance of it.
Persons = new ObservableCollection<Person>(from i in Persons orderby i.Age select i);
An ObservableCollection
can take in an IEnumerable<T>
(i.e, in this instance, your IOrderedEnumerable
) from it's constructor:
You might want to simply create a new ObservableCollection
from the sorted enumerable.