Tag Archives: programming tips

Sorting with LINQ: don’t use anonymous types

I got the error message “System.ArgumentException: At least one object must implement IComparable.” today for the following, seemingly innocuous code. var ordered = order.Lines.OrderBy(l => new { l.AdminCode, l.OrderLineNr}); I thought this was the way to do it; after, that’s the way that you use Join() for multiple properties. What it was however was a

Using asymmetric properties in views

Many people separate their business logic and view classes into two or more separate assemblies. This gives rise to the ability to use an asymmetric set for view properties that aren’t meant to be accessible. Simply put: public string SomeProperty { get; internal set; } The internal modifier means that this property is only accessible

Google Docs API: get all spreadsheets/docs in a folder

It’s easy enough to get a list of spreadsheets for a user, or a list of folders, but there’s a trick to getting the contents of a folder. The first part of the trick is to ignore the category. Firstly, because it’s removed in version 3.0 of the API, and secondly because it filters by