Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Disambiguating an overloaded method with multiple parameters #1099

Closed
@integerfn

Description

@integerfn

Environment

  • Pythonnet version: 2.3.0 and 2.4.0
  • Python version: 3.6.5
  • Operating System: W10

Details

The C# side

publicenumMyEnum:byte{Success=(byte)'S',Error=(byte)'E'}publicclassMyClass{publicDictionary<Enum,BlockingCollection<ISomeInterface>>MyDictionary{get;}publicMyClass(){MyDictionary=newDictionary<Enum,BlockingCollection<ISomeInterface>>();}}

On the python side, I began with this code

fromSystem.Collections.ConcurrentimportBlockingCollectionfromMyModuleimportMyClass,ISomeInterface,MyEnumobj=MyClass()collection=BlockingCollection[ISomeInterface]()obj.MyDictionary.Add(MyEnum.Success,collection)

This fails withTypeError: No method matches given arguments for Add. I've tried what seemed to solve it for#935 but get the same results

fromSystem.Collections.ConcurrentimportBlockingCollectionfromSystemimportEnumfromMyModuleimportMyClass,ISomeInterface,MyEnumobj=MyClass()collection=BlockingCollection[ISomeInterface]()obj.MyDictionary.Add[Enum,BlockingCollection[ISomeInterface]](MyEnum.Success,collection)

This fails withTypeError: No match found for given type params

  • The output ofprint(obj.MyDictionary.Add.__overloads__) is
VoidAdd(System.Enum,System.Collections.Concurrent.BlockingCollection`1[MyModule.ISomeInterface])

UPDATE

Running this code alone actually works,add shows as a bound method in the debugger:

add=obj.MyDictionary.Add.Overloads[Enum,BlockingCollection[ISomeInterface]]

However, attempting to call the function always fails. I've attempted passing System.byte and 0, instead of the enum, but none of them work.

add(MyEnum.Success,collection)obj.MyDictionary.Add[Enum,BlockingCollection[ISomeInterface]](MyEnum.Success,collection)obj.MyDictionary.Add.Overloads[Enum,BlockingCollection[ISomeInterface]](MyEnum.Success,collection)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp