Title: `SwitchParameter.IsPresent` documentation does not match actual behavior when parameter is explicitly set to `false` · Issue #26149 · PowerShell/PowerShell · GitHub
Open Graph Title: `SwitchParameter.IsPresent` documentation does not match actual behavior when parameter is explicitly set to `false` · Issue #26149 · PowerShell/PowerShell
X Title: `SwitchParameter.IsPresent` documentation does not match actual behavior when parameter is explicitly set to `false` · Issue #26149 · PowerShell/PowerShell
Description: The inline documentation for the IsPresent property states that it returns true if the parameter was specified on the command line, and false otherwise: ///
Open Graph Description: The inline documentation for the IsPresent property states that it returns true if the parameter was specified on the command line, and false otherwise: ///
X Description: The inline documentation for the IsPresent property states that it returns true if the parameter was specified on the command line, and false otherwise: /// <summary> /// Returns true if the ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/26149
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`SwitchParameter.IsPresent` documentation does not match actual behavior when parameter is explicitly set to `false`","articleBody":"The inline documentation for the `IsPresent` property states that it returns `true` if the parameter was specified on the command line, and `false` otherwise:\n\n```cs\n/// \u003csummary\u003e\n/// Returns true if the parameter was specified on the command line, false otherwise.\n/// \u003c/summary\u003e\n/// \u003cvalue\u003eTrue if the parameter was specified, false otherwise\u003c/value\u003e\npublic bool IsPresent\n{\n get { return _isPresent; }\n}\n```\n\nHowever, this description is inaccurate. The property returns `false` when a parameter is explicitly specified on the command line with a value of `false`.\n\n### Proposed Resolution\n\nEither:\n1. **Clarify documentation** to specify that the property returns `false` both when the parameter is _not specified_ and when it is _explicitly specified with a value of `false`_; or\n1. **Adjust implementation** so that `IsPresent` returns `true` whenever the parameter is explicitly supplied, regardless of its value.\n1. **Deprecate** `IsPresent` in favor of a clearer or more accurately named property that distinguishes between 'parameter presence' and 'parameter value'.","author":{"url":"https://github.com/xtqqczze","@type":"Person","name":"xtqqczze"},"datePublished":"2025-10-05T15:18:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/26149/PowerShell/issues/26149"}
| 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:fd998b37-81e8-d402-4a84-6b6622dcc229 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC38:12A6C9:132CFD6:1BA4FBC:6A4E5FC4 |
| html-safe-nonce | 80e3b4c4435d83eba4e0d5af46082535a53fae6edbf67fe5d6842b084170818b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzM4OjEyQTZDOToxMzJDRkQ2OjFCQTRGQkM6NkE0RTVGQzQiLCJ2aXNpdG9yX2lkIjoiMjMwMjA3OTkyMzg2MTIxNzIyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ac6c3120f5ddbbe9f6ae2db3f42dc68bf590a3a2d723cdc389219ee3d64e4d4a |
| hovercard-subject-tag | issue:3484895543 |
| 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/26149/issue_layout |
| twitter:image | https://opengraph.githubassets.com/703310df4278794c100cdc0351509f44199539a61fe0b4f05d9366f1cc6b7fff/PowerShell/PowerShell/issues/26149 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/703310df4278794c100cdc0351509f44199539a61fe0b4f05d9366f1cc6b7fff/PowerShell/PowerShell/issues/26149 |
| og:image:alt | The inline documentation for the IsPresent property states that it returns true if the parameter was specified on the command line, and false otherwise: /// |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | xtqqczze |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| 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 | 55abf6b50233e48592f2087d3226df604c65feb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width