KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a List of DateTimeOffset objects, and I want to insert new ones into the list in order. List<DateTimeOffset> TimeList = ... // determine the order before insert or add the new item Sorry, need to update my question. List<customizedClass> ItemList = ... //customizedClass contains DateTimeOffset object and other strings, int, etc. ItemList.Sort(); // this won't work until set data comparison with DateTimeOffset ItemList.OrderBy(); // this won't work until set data comparison with DateTimeOffset Also, how to put DateTimeOffset as the parameter of .OrderBy() ? I have also tried: ItemList = from s in ItemList orderby s.PublishDate descending // .PublishDate is type DateTime select s; However, it returns this error message, Cannot implicitly convert type 'System.Linq.IOrderedEnumerable' to 'System.Collections.Gerneric.List'. An explicit conversion exist (are you missing a cast?)
Tags (comma-separated)
Save Edits
Cancel