为什么类和关键字继承到Generic接口? [英] Why the class and where Keywords inherited to Generic interface?
本文介绍了为什么类和关键字继承到Generic接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的代码片段中,我看到以下行
In my code snippet i have seen the below line
public interface IDbSet<tentity> : IQueryable<tentity>, IEnumerable<tentity>, IQueryable, IEnumerable where TEntity : class
这个目的是什么,请您简要介绍一下这个的优点。
[edit]已添加代码块 - OriginalGriff [/ edit]
what is the purpose of this could you please tell me briefly what is the advantage of this.
[edit]Code block added - OriginalGriff[/edit]
推荐答案
它声明了一个新的界面
它实现了四个现有接口,并坚持使用它的Generic参数必须是class
:它不能是另一个接口
或struct
。
如果您不了解接口,那么您需要从这里开始: http://msdn.microsoft.com/en-us/library/ms173156.aspx [ ^ ] - 在一个小文本框中讨论它有点太大了!
It's declaring a newinterface
which implements four existing interfaces, and which insists that the Generic parameter that it is used with must be aclass
: it can't be anotherinterface
or astruct
.
If you don't understand interfaces, then you need to start here: http://msdn.microsoft.com/en-us/library/ms173156.aspx[^] - it's a bit too big to discuss in a small textbox!
可能在里面接口有使用TEntity类的方法。我可以进行包含返回值和/或参数方法的预测,这些方法使用像IEnumerable一样的集合(
Probably inside interface there are methods that use TEntity class.I can make a prediction that contains return value and/or arguments methods which use something IEnumerable like collection (
new List<myclass>
)以及与linq相关的东西。
希望有用。
嗨。
) and something related to linq as well.
Hope helpful.
Hi.
这篇关于为什么类和关键字继承到Generic接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文