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

Type parameter works directly, but fails insideList<> #962

Closed
@ghost

Description

Environment

  • Pythonnet version: 2.4.0
  • Python version: Python 3.7.4
  • Operating System: Windows 10 (18362.356)

Details

  • Describe what you were trying to get done.

Call a generic method taking a list parameter.

C# library:

usingSystem.Collections.Generic;namespaceCSLib{publicstaticclassCSLib{publicstaticboolGetBool()=>true;publicstaticvoidTestValue<T>(Tt){}publicstaticList<bool>GetBoolList()=>newList<bool>(){true,false};publicstaticvoidTestList<T>(List<T>list){}publicstaticvoidTest(){TestValue<bool>(GetBool());TestList<bool>(GetBoolList());}}}

Python code:

fromclrimportAddReferencefrompathlibimportPathAddReference(str(Path.cwd()/"cslib/bin/Debug/netstandard2.0/cslib.dll"))fromSystemimportBooleanfromCSLibimportCSLibCSLib.TestValue[Boolean](CSLib.GetBool())CSLib.TestList[Boolean](CSLib.GetBoolList())

It works fine when the type argument is used directly, but fails when it is insideList<>.

  • If there was a crash, please include the traceback here.
Traceback (mostrecentcalllast):File"a.py",line11,in<module>CSLib.TestList[Boolean](CSLib.GetBoolList())TypeError:NomethodmatchesgivenargumentsforTestList

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