I have myClass
which contains a field myList
which is a list of elements from myEnum
. I would like to add to this list more elements but in python. However exec(f"myClass.myList.Add(myEnum.{e}))"
doesnt work because myClass.myList
in Python is a list of integers. What can I do? I want to add elements by its name, not its int position.
Asked
Active
Viewed 481 times
0

Cugusek
- 3
- 1
-
i dunno if i understant, because its not very clear... but you cant modify an enum list dynamically.. – Frenchy Apr 02 '22 at 17:47
-
I dont want to codify enum, but list of enums. How can I add new element to existing list in pythonnet? – Cugusek Apr 02 '22 at 18:20
1 Answers
0
Switch to pythonnet 3.0 previews. In 3.0 .NET lists are not converted to Python lists, instead they just behave like Python lists when seen from Python.

LOST
- 2,956
- 3
- 25
- 40