Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Calling 'params' method with single argument fails #331

Copy link
Copy link
@limdaepl

Description

@limdaepl
Issue body actions

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.

galpin

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.