Title: Allow `$null` on right-hand side of `-is` and `-isnot` operators. · Issue #10656 · PowerShell/PowerShell · GitHub
Open Graph Title: Allow `$null` on right-hand side of `-is` and `-isnot` operators. · Issue #10656 · PowerShell/PowerShell
X Title: Allow `$null` on right-hand side of `-is` and `-isnot` operators. · Issue #10656 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement As a scripter, I want to use -is and -isnot when comparing a value against $null instead of -eq and -ne so that the comparison always works, even with collections or with types that overload the equ...
Open Graph Description: Summary of the new feature/enhancement As a scripter, I want to use -is and -isnot when comparing a value against $null instead of -eq and -ne so that the comparison always works, even with collect...
X Description: Summary of the new feature/enhancement As a scripter, I want to use -is and -isnot when comparing a value against $null instead of -eq and -ne so that the comparison always works, even with collect...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10656
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow `$null` on right-hand side of `-is` and `-isnot` operators.","articleBody":"# Summary of the new feature/enhancement\r\n\r\nAs a scripter,\r\nI want to use `-is` and `-isnot` when comparing a value against `$null` instead of `-eq` and `-ne`\r\nso that the comparison always works, even with collections or with types that overload the equality operator.\r\n\r\nFor reference: https://youtu.be/TJiLhRPgyq4?list=PLReL099Y5nRd04p81Q7p5TtyjCrj9tz1t\u0026t=373\r\n\r\n# Proposed technical implementation details (optional)\r\n\r\nUpdate the implementation of the `-is` and `-isnot` operators such that they allow `$null` in addition to types on the right operand, and when comparing against null they simply use the C# `is` operator internally to perform the comparison (which they may do already, so this may be a very trivial change to make.\r\n\r\nThis change makes for a much more expressive syntax as well, which reads very well in PowerShell.\r\n\r\nHere is what I want to work once this is implemented:\r\n\r\n```powershell\r\n$x -is $null\r\n$y -isnot $null\r\n$collection | where Property -is $null\r\n$collection | where Property -isnot $null\r\n```\r\n\r\nI plan on implementing this PR as part of Hacktoberfest.","author":{"url":"https://github.com/KirkMunro","@type":"Person","name":"KirkMunro"},"datePublished":"2019-10-01T02:28:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/10656/PowerShell/issues/10656"}
| 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:057570ed-0b1a-5390-5538-e1c0c61e4666 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA50:1E1ACC:4C7DED:6726E0:6A5B2C24 |
| html-safe-nonce | 069f667a0e3770be6e15b68606ed98df6d3cadf96a1e3b6546eb057c6f764746 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTUwOjFFMUFDQzo0QzdERUQ6NjcyNkUwOjZBNUIyQzI0IiwidmlzaXRvcl9pZCI6IjQwOTE3Nzk4NzMxMDY2NDA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 267b9736d3d4a1ad35bbe1b22f3ca334fffe1c19afc8e613f8b82e52d6274a53 |
| hovercard-subject-tag | issue:500623099 |
| 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/10656/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be295bc055f662593c1d3c6e35a1dd25260b5f1e724ad8ee57a294dff33ff6ef/PowerShell/PowerShell/issues/10656 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be295bc055f662593c1d3c6e35a1dd25260b5f1e724ad8ee57a294dff33ff6ef/PowerShell/PowerShell/issues/10656 |
| og:image:alt | Summary of the new feature/enhancement As a scripter, I want to use -is and -isnot when comparing a value against $null instead of -eq and -ne so that the comparison always works, even with collect... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KirkMunro |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width