gpt4 book ai didi

c# - 是否有可能将 C# 中的索引器声明为抽象成员?

转载 作者:可可西里 更新时间:2023-11-01 09:01:22 24 4
gpt4 key购买 nike

如标题所述,我想在抽象类中声明一个索引器 object this[int index] 作为抽象成员。

这有可能吗?是否也可以在接口(interface)中声明它?

最佳答案

Of course :

public abstract class ClassWithAbstractIndexer 
{
public abstract int this[int index]
{
get;
set;
}
}

关于c# - 是否有可能将 C# 中的索引器声明为抽象成员?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7626187/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com