Self referencing interface

后端 未结 4 1958
眼角桃花
眼角桃花 2021-01-18 05:15

This is the kind of thing I want to do:

Interface IMyInterface
{
    List GetAll(string whatever)
}

so that classes imp

4条回答
  •  不思量自难忘°
    2021-01-18 05:50

    I don't see why interface could not reference itself - no problem with below.

    interface ITest
    {
        List GetAll(string whatever);
    }
    
    class MyClass : ITest
    {
        public List GetAll(string whatever)
        {
            return new List();
        }
    }
    

提交回复
热议问题