我今天遇到了这段代码,我无法弄清楚它的含义。我找不到关于它的 MSDN 帖子
public interface ITestCase <out Tview, out Tmodel>
where ...
where ...
{
...
IUITestCase<Tview> this[int index] {get;}
...
}
其余代码似乎对这个问题毫无用处,但如果需要我会发布。 有人对属性(property)有解释吗?谢谢!
最佳答案
这些是索引器
。参见 MSDN Dcumenation
更新
首先感谢 Alexandru-Ionut Mihai
指出,这是 Indexers
的通用构造。
索引器提供类似数组的语法。它允许以与数组相同的方式访问类型。正如您的示例代码中所见。
关于c# - 在 C# 中,Type<T> this [int index] 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43466358/