Let's say you are given the following...
List<Thing> theThings = fubar.Things.All();
If there were nothing to return, what would you expect fubar.Things.All() to return?
Edit: Thanks for the opinions. I'll wait a bit and accept the entry with the most ups.
I agree with the responses so far, particularly those suggesting an empty collection. A vendor provided an API with several calls similar to the example above. A vendor who did $4.6 million in revenue via their API(s) last year, BTW. They do something I fundamentally disagree with -- they throw an exception.
Things
? If it makes sense to have theThings
field return null, then it makes sense for you to receive an exception because you did not check for null before your call toAll()
. However, I agree with the people who thinkfubar.Things
should return an empty collection instead of null.