Retrieve IQueryable Result in Public Methods

Viewed 43

Is it a valid architeture to declare public methods that retrieve IQueryable results like below :

public IQueryable GetData()
1 Answers

Yes it is, but please be aware that with IQueryable (just like IEnumerable, IList or ICollection) you need to include the type:

Generic:

public IQueryable<T> GetData()

String:

public IQueryable<string> GetData()

Remember that IQueryable (just like all the previous mentioned interfaces) inherits from IEnumerable.

Related