New to the MVC.net scene (and .net for that matter), but seems I find a wide array of options when wanting to populate a \"list\" with data. In my case at the moment, I\'d
My rules of thumb:
Use a List when you have to add, remove, or refer to an item by index.
Use a IQueryable
when you have to run ad-hoc queries against it.
Use IEnumerable
by default.
It looks like you're already doing the query "in" your database, so I'd suggest using the simplest version: IEnumerable
to simply be able to loop through the results.
Each interface has its own set of uses.
IQueryable is for deferred queries (that is, it saves the query but only executes it when it is enumerated)
IEnumerable can be enumerated and that's it.
IList can have items added and removed.
If your new to .NET and C# I'd spend some time researching and becoming knowledgeable about what the different collection types are, how they differ, and when to use them. You'll use collections so often it you cannot afford to have a "simple one liner" summary understanding like the other answerers posted.
Here is a good guide on .NET collection types: http://msdn.microsoft.com/en-us/library/0ytkdh4s.aspx
IQueryable is its own special beast and deserves its own guide: http://msdn.microsoft.com/en-us/library/system.linq.iqueryable.aspx