views:

71

answers:

1

I'm using NHibernate to retrieve a list from the database based on some criteria.

List<MyType> myList = GetByCriteria(...)

Does anyone know whether myList will be null or an empty list of MyType if no results are found that match the criteria?

I've been looking through the NHibernate documentation and searching in google but I can't find anything that tells me one way or another.

+1  A: 

The simplest answer would be to test it... but I'd be astonished if it returned null. I'd definitely expect it to return an empty list.

Jon Skeet
yeah, you're right..I should have tested it... I've tested it now and it definitely returns an empty list which is what I was expecting. Some other developer had been writing code to double check that the returned list was not null and it got me curious at a time when I didn't have a chance to do a write test...so I did a quick search which pulled up no clues so I figured I'd document the question on StackOverflow :)
mezoid