Using C# params keyword in a constructor of generic types

前端 未结 4 960
后悔当初
后悔当初 2021-02-14 20:42

I have a generic class in C# with 2 constructors:

public Houses(params T[] InitialiseElements)
{}
public Houses(int Num, T DefaultValue)
{}

Con

4条回答
  •  野的像风
    2021-02-14 21:18

    Perhaps instead of Params you could pass in IEnumerable

    public Houses(IEnumerable InitialiseElements){}
    

提交回复
热议问题