简体   繁体   English

在公共方法中检索 IQueryable 结果

[英]Retrieve IQueryable Result in Public Methods

Is it a valid architeture to declare public methods that retrieve IQueryable results like below:声明检索 IQueryable 结果的公共方法是否有效,如下所示:

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:是的,但请注意,使用 IQueryable(就像 IEnumerable、IList 或 ICollection)需要包含以下类型:

Generic:通用的:

public IQueryable<T> GetData()

String:细绳:

public IQueryable<string> GetData()

Remember that IQueryable (just like all the previous mentioned interfaces) inherits from IEnumerable.请记住,IQueryable(就像前面提到的所有接口一样)继承自 IEnumerable。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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