Why does C# not allow generic properties?

后端 未结 5 1646
野性不改
野性不改 2020-12-03 07:03

I was wondering why I can not have generic property in non-generic class the way I can have generic methods. I.e.:

public interface TestClass
{
   IEnumerabl         


        
5条回答
  •  感动是毒
    2020-12-03 07:25

    This Generic Properties blog post from Julian Bucknall is a pretty good explanation. Essentially it's a heap allocation problem.

提交回复
热议问题