Title: Sypport typeof(T) or clr.GetClrType · Issue #432 · pythonnet/pythonnet · GitHub
Open Graph Title: Sypport typeof(T) or clr.GetClrType · Issue #432 · pythonnet/pythonnet
X Title: Sypport typeof(T) or clr.GetClrType · Issue #432 · pythonnet/pythonnet
Description: In order to do reflection, you need to acquire the Type instance for imported class. In C#, this is done by Type t = typeof(MyClass) In IronPython, this is done by t = clr.GetClrType(MyClass) Python.net seems to be missing this functiona...
Open Graph Description: In order to do reflection, you need to acquire the Type instance for imported class. In C#, this is done by Type t = typeof(MyClass) In IronPython, this is done by t = clr.GetClrType(MyClass) Pytho...
X Description: In order to do reflection, you need to acquire the Type instance for imported class. In C#, this is done by Type t = typeof(MyClass) In IronPython, this is done by t = clr.GetClrType(MyClass) Pytho...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/432
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sypport typeof(T) or clr.GetClrType","articleBody":"In order to do reflection, you need to acquire the Type instance for imported class.\r\n\r\nIn C#, this is done by\r\n\r\n```\r\nType t = typeof(MyClass)\r\n```\r\n\r\nIn IronPython, this is done by\r\n\r\n```\r\nt = clr.GetClrType(MyClass)\r\n```\r\n\r\nPython.net seems to be missing this functionality.\r\n\r\nI currently have this horrible hack, and I'm unsure how far it will work:\r\n\r\n```python\r\ndef get_clr_type(typ):\r\n \"\"\" simulate typeof(T) or GetClrType from IronPython.\r\n\r\n Horrible hack, redo\r\n \"\"\"\r\n name = typ.__module__ + \".\" + typ.__name__\r\n return Type.GetType(name)\r\n```\r\n\r\nFor reference, code using this resides in: https://github.com/vivainio/pynetext/blob/master/pynetext.py","author":{"url":"https://github.com/vivainio","@type":"Person","name":"vivainio"},"datePublished":"2017-03-21T21:51:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/432/pythonnet/issues/432"}
| 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:c8869e44-f4ab-fcc7-5b00-9f95ac65537f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C1C:69CA6:2AC6107:396CCC7:69705215 |
| html-safe-nonce | 28b0f71d38c7a23d24f5c99b9e22082f80eb0ddaea9e0f7d2a81a7dc4c695b22 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzFDOjY5Q0E2OjJBQzYxMDc6Mzk2Q0NDNzo2OTcwNTIxNSIsInZpc2l0b3JfaWQiOiI1NjY3MDk2NDU5OTIwNTYwNjYxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7b01e6a3170fb5e321f4a270fb43057dfadf3a427f34283597a92d505f12d1f8 |
| hovercard-subject-tag | issue:215889666 |
| 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/432/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d8edef726f67de8199f797881fe7bac8d9467e868116607434d39c3314bc7c8d/pythonnet/pythonnet/issues/432 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d8edef726f67de8199f797881fe7bac8d9467e868116607434d39c3314bc7c8d/pythonnet/pythonnet/issues/432 |
| og:image:alt | In order to do reflection, you need to acquire the Type instance for imported class. In C#, this is done by Type t = typeof(MyClass) In IronPython, this is done by t = clr.GetClrType(MyClass) Pytho... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vivainio |
| 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 | f643964067a552f02067066d6a910b2f90a5721f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width