Skip to content

Support variadic parameters for .NET #153

@mpiroc

Description

@mpiroc

This might be more involved that just adding the "params" keyword. Consider the following signature:

public void DoSomething(params object[] myParam)
{
}

// ...

object[] foo = // ...
// Because an object[] is also an object, the compiler treats foo as the first element
// of the params array, rather than the params array itself.
DoSomething(foo);

But in this case, there's no ambiguity:

public void DoSomething(params string[] myParam)
{
}

// ...

string[] foo = // ...

// The compiler treats foo as the params array, rather than the first element of the params array.
DoSomething(foo);

This might not matter, since generated code does not include any invocations of the generated methods. Just something to keep in mind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumMedium work item – a couple days of effortfeature-requestA feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdlanguage/dotnetRelated to .NET bindings (C#, F#, ...)p0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions