C# Multiple Indexers

后端 未结 7 1079
深忆病人
深忆病人 2020-12-30 05:10

Is it possible to have something like the following:

class C
{
    public Foo Foos[int i]
    {
        ...
    }

    public Bar Bars[int i]
    {
        .         


        
7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-30 05:45

    C# doesn't have return type overloading. You can define multiple indexers if their input parameters are different.

提交回复
热议问题