"It's that easy"

Quick Tip: LINQ OrderBy and ThenBy

The other day I required ordering a list of people first by the date they were created, and then by their last name. I spent forever trying to find out why my two OrderBy statements were conflicting with one another, until I remembered you use “ThenBy()” for any additional sorting you want to do. So the query looked something like this then: IEnumerable<Person> myPersons = myDataContext.Persons .OrderBy(m=>m.DateCreated) .ThenBy(m=>m.LastName); Just thought I’d share! It’s easy to forget ......

“Seriously? It’s that easy?” Episode 1: Generic Interfaces

So this is episode 1 of a series of blog posts I will be writing on things I could not figure out for the longest time, only to have an “ohhh moment” followed by a “seriously? it’s that easy?” moment. The first moment I will be describing occurred to me about a month or two ago when I finally understood how to use a generic interface. I had sort of captured the idea of interfaces by that point—that it’s basically like a binding contract that says ,if you implement me in a class, then you are required ......