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:
http://msdn.microsoft.com/en-us/library/cc679169.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With