Title: Get Value Of An Enum · Issue #1585 · pythonnet/pythonnet · GitHub
Open Graph Title: Get Value Of An Enum · Issue #1585 · pythonnet/pythonnet
X Title: Get Value Of An Enum · Issue #1585 · pythonnet/pythonnet
Description: Environment Pythonnet version: latest Python version: 3.9.4 Operating System: Windows .NET Runtime: Details Describe what you were trying to get done. I would like to have the ability to extract the value of a .Net Enum via python. One c...
Open Graph Description: Environment Pythonnet version: latest Python version: 3.9.4 Operating System: Windows .NET Runtime: Details Describe what you were trying to get done. I would like to have the ability to extract th...
X Description: Environment Pythonnet version: latest Python version: 3.9.4 Operating System: Windows .NET Runtime: Details Describe what you were trying to get done. I would like to have the ability to extract th...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1585
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get Value Of An Enum","articleBody":"### Environment\r\n\r\n- Pythonnet version: latest\r\n- Python version: 3.9.4\r\n- Operating System: Windows\r\n- .NET Runtime:\r\n\r\n### Details\r\n\r\n- Describe what you were trying to get done.\r\n\r\nI would like to have the ability to extract the value of a .Net `Enum` via python. One can do that using `MyEnum.value__`, however it seems logical that you should do it using `int(MyEnum)`.\r\n\r\n- What commands did you run to trigger this issue? If you can provide a\r\n [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)\r\n this will help us understand the issue.\r\n\r\n```python\r\nimport clr\r\n\r\nclr.AddReference(\"System.Windows.Forms\")\r\n\r\nimport System.Windows.Forms as WinForms\r\n\r\nenum_value = WinForms.Keys.Control\r\nprint(f\"{enum_value=}\")\r\nprint(f\"{enum_value.value__=}\")\r\n```\r\n\r\nThat prints:\r\n```\r\nenum_value=\u003cSystem.Windows.Forms.Keys object at 0x000001C053E07580\u003e\r\nenum_value.value__=131072\r\n```\r\n\r\n- If there was a crash, please include the traceback here.\r\n\r\nNo crash.\r\n","author":{"url":"https://github.com/saroad2","@type":"Person","name":"saroad2"},"datePublished":"2021-10-03T11:41:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/1585/pythonnet/issues/1585"}
| 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:6227db29-aacf-8094-39b7-d01a8c83c636 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B708:7E0E0:1F5D1DF:2A83C28:697083C8 |
| html-safe-nonce | 6c7fd0f9d2eae9b70331ae88b089184bcfd8662a1bd6a3d581089dd4dd983c9c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzA4OjdFMEUwOjFGNUQxREY6MkE4M0MyODo2OTcwODNDOCIsInZpc2l0b3JfaWQiOiI2ODkzMDkwMjc0NjUzNzk5MzY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 72042bff7880ec3a4cf9becd7393fecba51a6db58ad10d8bd4d7d7bded57eb03 |
| hovercard-subject-tag | issue:1014364491 |
| 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/1585/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9314aeb537d0a5cee2ad166fa29a18986b683501c0262bb3c36aa0988ea4942/pythonnet/pythonnet/issues/1585 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9314aeb537d0a5cee2ad166fa29a18986b683501c0262bb3c36aa0988ea4942/pythonnet/pythonnet/issues/1585 |
| og:image:alt | Environment Pythonnet version: latest Python version: 3.9.4 Operating System: Windows .NET Runtime: Details Describe what you were trying to get done. I would like to have the ability to extract th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | saroad2 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| 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 | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width