Skip to content

Calling 'params' method with single argument fails #331

@limdaepl

Description

@limdaepl

Environment

  • Pythonnet version: 2.1.0
  • Python version: 2.7.10
  • Operating System: Microsoft Windows 7 Professional 6.1.7601 Service Pack 1 Build 7601

Details

When calling a method with the params keyword with a single argument I get

TypeError: No method matches given arguments

To reproduce:

C#:

public class Foo
{
    public void Bar(params int[] values)
    {
        foreach (var value in values)
        {
            Console.WriteLine(value);
        }
    }
}

Python:

foo = Foo()

foo.Bar([2,3,5,7]) # works
foo.Bar(2,3,5,7) # works

foo.Bar([5]) # works
foo.Bar(5) # TypeError: No method matches given arguments

This is probably related to the meta-issue #265.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions