Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive


Tim Jones

You could replace the "Count() == 0" conditions with "!Any()" for additional elegance :)

Eugene Burmako

Yeah, quite scary, barely debuggable, but I vote for such style. Imho a drastic increase in the quality of both reading (conciseness = less to read, easier to understand) and writing (conciseness = less points to introduce an error) far supercedes these inconveniences. And after all most of the time it's only the signature that matters to this method's user.

Rasmus Faber

The Pluralize-method seems a bit naive. Try calling it with "boy" or "monkey".


Pluralize :) ... lol

Jason Jarrett

You might want to look at .ToList()ing the enumerabe variables, as leaving them as enumerable will cause "elements" and "attributes" variable to be re-evaluated each time you do anything with them (such as attributes.Count()) - this method may perform a little faster as well...

Thilak Nathen


The code is perfectly debuggable. You realist the debugger allows you to step through linq statements even on vs 2008.


Is it Newtonsoft.Json?


Pls comment your code :)

Eugene Burmako


Debugging lazy LINQ-to-Objects queries is quite inconvenient in comparison with debugging regular collections. Yeh, you can still "enumerate the results", but it's an extra click/keystroke as opposed to watching a collection with a debug visualizer.

And, what's more important, you can't watch the result of partial application of a query, e.g. the result of lines 4 and 5, but not 6 on the screenshot above). The best what I can come with is to manually refactor subquery into a local variable, but this requires manual work tho R# can alleviate it significantly. Usually, one has to repeat this for a few times because it's rare to find a bug at the very first watch you perform.

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats