I am going through a tutorial for asp.net and C# and the author used some code that I am trying to understand. I have an idea of what it does, but I just wanted to make sure.
public IQueryable<Category> GetCategories() { var db = new WingtipToys.Models.ProductContext(); IQueryable<Category> query = db.Categories; return query; } I am a little confused by
IQueryable<Category> as well as the line
IQueryable<Category> query = db.Categories; What I think it does is that it is a method called GetCategories() that only accepts Category objects. The method defines a new instance productcontext, it then runs some type of query and returns it. I could be close or way off. I just want to make sure.
IQueryable<Category>is an instance of theIQueryableinterface that is specialized to work withCategoryobjects, the same asList<Category>is aListthat only works withCategoryobjects.