Reputation: 235
What return type should one return from a method that is getting rows from the database. Should you keep the data in a dataset / datatable, should you create a collection of objects representing the data, or should you return an interface such as IList or IEnumerable, etc?
I know the real answer is "it depends", but I am just curious as to best practices that others observe. Dataset / datatable seems the simplest, but returning an interface seems to be the way it should be done. How are you all doing it?
Upvotes: 0
Views: 124
Reputation: 2405
Typically a collection of objects exposed via IList<T> or IEnumerable<T>, but why do the work yourself?
Upvotes: 1