Best way to refer to my own type

前端 未结 5 1958
轻奢々
轻奢々 2021-01-03 06:02
abstract class A where T:A
{
    public event Action Event1;
}

class B : A
{
    //has a field called Action Event1;
}
         


        
5条回答
  •  长情又很酷
    2021-01-03 06:36

    What you have works very well. In fact it's very similar to other .NET interfaces and types where you want the interface implementer to use your type, like:

    public class MyClass : IEqualityComparer
    {
        // From the interface IEqualityComparer
        public bool Equals(MyClass other) { ... }
    
        ...
    }
    

提交回复
热议问题