I cant for the life of me figure out why this List will not sort properly. Can someone point out what I am doing wrong?
List<WNBlogPost> posts = new List<WNBlogPost>();
IEnumerable<WNBlogPost> orderedPosts = (
from p in posts
select p
).OrderByDescending(c => c.ID);
foreach (WNBlogPost post in orderedPosts) {
//output post to page
}
I am adding items to the posts list in loop, but the order they are added to the list is the same order they appear in after I add OrderByDescending().
Any idea what I am doing wrong?
posts.OrderByDescending(c => c.ID)?postsinstead oforderedPostsby any chance?post.IDlook like?