C#C
C#4y ago
swilli

❔ Repeating parameters vs variadic functions

Does anybody know why the params keyword is not used more commonly? This example if from the ImmutableArray<> class. As you can see there's methods for creating an array from 1-4 args, and then it goes to an array arg, but the array method is then using the params keyword? Why not just use the params keyword on the first method so that it could take N args without needing multiple methods with differing amounts of parameters? I feel like I'm missing something here.
image.png
image.png
Was this page helpful?