Generic List of Generic Interfaces not allowed, any alternative approaches?

前端 未结 3 827
孤独总比滥情好
孤独总比滥情好 2021-02-03 23:41

I am trying to find the right way to use a Generic List of Generic Interfaces as a variable.

Here is an example. It is probably not the best, but hopefully you will get

3条回答
  •  鱼传尺愫
    2021-02-04 00:03

    You say it won't work because you don't define T. So define it:

    public class Holder
    {
        public List> Primitives {get;set;}
    }
    

提交回复
热议问题