简体   繁体   中英

Retrieve IQueryable Result in Public Methods

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

public IQueryable GetData()

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM