Why Do I need to redeclare type constraint in generic subclass

后端 未结 3 1996
故里飘歌
故里飘歌 2021-02-07 10:06

Recently I tried to create a generic subclass by implementing a generic interface.

public interface IModule where T : DataBean { ..... }
public class Mo         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 10:38

    Standard C# team wisdom. Declarations should be self-documenting. And most of all, a change in one type declaration should not alter the behavior of an unrelated other type without generating a diagnostic. The -100 points principle put into design is another take on that.

提交回复
热议问题