Title: Add conversion from PSMethodInfo to delegate/Func<> · Issue #2864 · PowerShell/PowerShell · GitHub
Open Graph Title: Add conversion from PSMethodInfo to delegate/Func<> · Issue #2864 · PowerShell/PowerShell
X Title: Add conversion from PSMethodInfo to delegate/Func<> · Issue #2864 · PowerShell/PowerShell
Description: As a step on the way to realize #2226, I think we should start with adding a conversion from PSMethodInfo to System.Func. Today, we have to do something like this: Class MyClass { [int] Add47([int] $value) { return 47 + $value } [int] Do...
Open Graph Description: As a step on the way to realize #2226, I think we should start with adding a conversion from PSMethodInfo to System.Func. Today, we have to do something like this: Class MyClass { [int] Add47([int]...
X Description: As a step on the way to realize #2226, I think we should start with adding a conversion from PSMethodInfo to System.Func. Today, we have to do something like this: Class MyClass { [int] Add47([int]...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/2864
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add conversion from PSMethodInfo to delegate/Func\u003c\u003e ","articleBody":"As a step on the way to realize #2226, I think we should start with adding a conversion from PSMethodInfo to System.Func.\r\n\r\nToday, we have to do something like this:\r\n```powershell\r\nClass MyClass {\r\n \r\n [int] Add47([int] $value) { \r\n return 47 + $value\r\n }\r\n \r\n [int] DoStuff([System.Collections.Generic.IEnumerable[int]] $collection) {\r\n # ugly\r\n $func = $this.GetType().GetMethod(\"Add47\").CreateDelegate([Func[int,int]], $this)\r\n return [Linq.Enumerable]::Sum($collection, $func)\r\n }\r\n}\r\n```\r\n\r\nI would like to express that as:\r\n```powershell\r\nClass MyClass { \r\n [int] Add47([int] $value) { \r\n return 47 + $value\r\n }\r\n \r\n [int] DoStuff([System.Collections.Generic.IEnumerable[int]] $collection) {\r\n return [Linq.Enumerable]::Sum($collection, $this.Add47)\r\n }\r\n}\r\n```\r\n\r\nWhat is the right place to do this?","author":{"url":"https://github.com/powercode","@type":"Person","name":"powercode"},"datePublished":"2016-12-09T10:43:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/2864/PowerShell/issues/2864"}
| 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:b1bbc201-4988-2057-ac3a-d30a1b2cdd1a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF6C:5FC26:20C4939:2F556EC:6A550094 |
| html-safe-nonce | d475a1c5ed53fe25ff2ce6352b881a02d5120650b8a027687e55e4c225726fee |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjZDOjVGQzI2OjIwQzQ5Mzk6MkY1NTZFQzo2QTU1MDA5NCIsInZpc2l0b3JfaWQiOiI0OTU2NDE5OTAzNzc3NDcyNjYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f369dc5aa62ed385398838732ecb3538f99ba852ec1caefffca74dcfa1b8687f |
| hovercard-subject-tag | issue:194565144 |
| 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/PowerShell/PowerShell/2864/issue_layout |
| twitter:image | https://opengraph.githubassets.com/401313f4d26ce32be92a9b092d75b768ab44579349b459a6324de7c3596eb78e/PowerShell/PowerShell/issues/2864 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/401313f4d26ce32be92a9b092d75b768ab44579349b459a6324de7c3596eb78e/PowerShell/PowerShell/issues/2864 |
| og:image:alt | As a step on the way to realize #2226, I think we should start with adding a conversion from PSMethodInfo to System.Func. Today, we have to do something like this: Class MyClass { [int] Add47([int]... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | powercode |
| hostname | github.com |
| expected-hostname | github.com |
| None | eae2aab99907699a22d2c8449aa683ca74454fca87211b98f7c7b722086b2839 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| 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 | 6a35ab858be185cd86d12b93a43bccf34e8d8536 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width