Using C# params keyword in a constructor of generic types

前端 未结 4 961
后悔当初
后悔当初 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:16

    The 2nd constructor is a more exact match, which is the criteria used to evaluate which constructor is correct.

提交回复
热议问题