Title: Unable to modify C# List
Open Graph Title: Unable to modify C# List
X Title: Unable to modify C# List
Description: Environment Pythonnet version: 2.4.0 Python version: 3.6 Operating System: windows 10 Details I have a C# class like this: public class X { public List
Open Graph Description: Environment Pythonnet version: 2.4.0 Python version: 3.6 Operating System: windows 10 Details I have a C# class like this: public class X { public List
X Description: Environment Pythonnet version: 2.4.0 Python version: 3.6 Operating System: windows 10 Details I have a C# class like this: public class X { public List<string> list; } I'm unable to do us...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1153
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to modify C# List\u003cT\u003e","articleBody":"### Environment\r\n\r\n- Pythonnet version: 2.4.0\r\n- Python version: 3.6\r\n- Operating System: windows 10\r\n\r\n### Details\r\n\r\nI have a C# class like this: \r\n\r\n```c#\r\npublic class X\r\n{\r\n public List\u003cstring\u003e list;\r\n}\r\n```\r\n\r\nI'm unable to do useful stuff with X.list due to the automatic value conversion of pythonnet.\r\n\r\nPreface:\r\n\r\n```python\r\npylist=[\"a\", \"b\", \"c\"]\r\nx=X()\r\nx.list=System.Collections.Generic.List[str]()\r\n```\r\nDoesnt work:\r\n\r\n```python\r\nx.list=System.Collections.Generic.List[str](pylist)\r\n```\r\n\r\nDoesnt work:\r\n\r\n```python\r\nfor i in pylist:\r\n x.list.Add(i)\r\n```\r\n\r\nDoesnt work: \r\n\r\n```python\r\nfor i in pylist:\r\n x.list.append(i)\r\n```\r\nx.list is always empty except for the .Add call, with throws Exception cause the value is converted to python list. How do I modify a C# List\u003cstring\u003e in python?\r\n\r\n","author":{"url":"https://github.com/jfu334","@type":"Person","name":"jfu334"},"datePublished":"2020-05-25T14:22:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/1153/pythonnet/issues/1153"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d882a213-d042-ea7c-67a6-77bd92996032 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B214:39BB24:2B7509E:39D3038:6971D261 |
| html-safe-nonce | f28d9dd1e1dba138556c0c6ccac835f69046e584450005102fe62a0ba060cbd0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjE0OjM5QkIyNDoyQjc1MDlFOjM5RDMwMzg6Njk3MUQyNjEiLCJ2aXNpdG9yX2lkIjoiMTgxNTY1MzE1MzYzMDE3OTkzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a022becd6419db62ed44bfb903e849628a1b1a0fc2b0e33ce01f5de98a9b6597 |
| hovercard-subject-tag | issue:624331170 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/1153/issue_layout |
| twitter:image | https://opengraph.githubassets.com/88e5d2eb3418729c2a0cd9ac4e4af398bb7bb28347632de66daedaf9b207a609/pythonnet/pythonnet/issues/1153 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/88e5d2eb3418729c2a0cd9ac4e4af398bb7bb28347632de66daedaf9b207a609/pythonnet/pythonnet/issues/1153 |
| og:image:alt | Environment Pythonnet version: 2.4.0 Python version: 3.6 Operating System: windows 10 Details I have a C# class like this: public class X { public List |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jfu334 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7476eb4140129667a7530d10cfb7688f701883e35a4dcaa4673e3ec599af5199 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2cc0827c872b538cd08371730242ae4951d2d61a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width