marosoaie marosoaie - 1 year ago 124
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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download