marosoaie marosoaie - 9 months ago 85
C# Question

Named Parameters and the params keyword in C#

I have a C# method with a variable length argument list declared using the


public void VariableLengthParameterFunction (object firstParam,
params object[] secondParam)

Is there any way of using named parameters when calling the method?

Answer Source

You can call it using named parameter like this:

    secondParam: new object[] { 5, 7, 3, 2 }, 
    firstParam: 4);