Title: Class : Methods and properties can't have the same name · Issue #8235 · PowerShell/PowerShell · GitHub
Open Graph Title: Class : Methods and properties can't have the same name · Issue #8235 · PowerShell/PowerShell
X Title: Class : Methods and properties can't have the same name · Issue #8235 · PowerShell/PowerShell
Description: Steps to reproduce class TestClass { [string] hidden $prop [string]Prop() { return $this.prop } } $obj = [TestClass]::new() Expected behavior Get an error saying you can't have a property and a method with the same name Actual behavior P...
Open Graph Description: Steps to reproduce class TestClass { [string] hidden $prop [string]Prop() { return $this.prop } } $obj = [TestClass]::new() Expected behavior Get an error saying you can't have a property and a met...
X Description: Steps to reproduce class TestClass { [string] hidden $prop [string]Prop() { return $this.prop } } $obj = [TestClass]::new() Expected behavior Get an error saying you can't have a property and a...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/8235
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Class : Methods and properties can't have the same name","articleBody":"\u003c!--\r\n\r\nFor Windows PowerShell 5.1 issues, suggestions, or feature requests please use the following link instead:\r\n- Windows PowerShell [UserVoice](https://windowsserver.uservoice.com/forums/301869-powershell)\r\n\r\nIf it is a bug report:\r\n- make sure you are able to repro it on the latest released version. \r\nYou can install the latest version from https://github.com/PowerShell/PowerShell/releases\r\n- Search the existing issues.\r\n- Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- Refer to the [known issues](https://docs.microsoft.com/powershell/scripting/whats-new/known-issues-ps6?view=powershell-6).\r\n- Fill out the following repro template:\r\n\r\nIf it's not a bug, please remove the template and elaborate the issue in your own words.\r\n-->\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\nclass TestClass {\r\n [string] hidden $prop\r\n\r\n [string]Prop() {\r\n return $this.prop\r\n }\r\n}\r\n\r\n$obj = [TestClass]::new()\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\nGet an error saying you can't have a property and a method with the same name\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n```powershell\r\nPS C:\\EDICore> $obj | Get-Member\r\n\r\n\r\n TypeName: TestClass\r\n\r\nName MemberType Definition\r\n---- ---------- ----------\r\nEquals Method bool Equals(System.Object obj)\r\nGetHashCode Method int GetHashCode()\r\nGetType Method type GetType()\r\nProp Method string Prop()\r\nToString Method string ToString()\r\n\r\n\r\nPS C:\\EDICore> $obj.Prop()\r\nMethod invocation failed because [TestClass] does not contain a method named 'Prop'.\r\nAt line:1 char:1\r\n+ $obj.Prop()\r\n+ ~~~~~~~~~~~\r\n+ CategoryInfo : InvalidOperation: (:) [], RuntimeException\r\n+ FullyQualifiedErrorId : MethodNotFound\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```powershell\r\n> $PSVersionTable\r\nName Value\r\n---- -----\r\nPSVersion 6.1.0\r\nPSEdition Core\r\nGitCommitId 6.1.0\r\nOS Microsoft Windows 6.1.7601 S\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/AlexBillon07","@type":"Person","name":"AlexBillon07"},"datePublished":"2018-11-12T13:41:31Z","url":"https://github.com/PowerShell/PowerShell/issues/8235"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:bcd0759e-5fc7-cae1-7a09-956e36f0b6e3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9324:3080FC:7E2AB8:B0A65C:6AFDC4A4 |
| html-safe-nonce | c662dca13ba2fd7864e2116ee6a8f612574a1ca941daeaee87c2f22609d4ad88 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzI0OjMwODBGQzo3RTJBQjg6QjBBNjVDOjZBRkRDNEE0IiwidmlzaXRvcl9pZCI6Ijg1MzU5MTU0ODAxNDgxOTg1NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | eeb5bfc3bb7508d63a872fd0355112831ec6fa76d9758331ca82852908b52108 |
| hovercard-subject-tag | issue:379781856 |
| 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/8235/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04490c1ea50550c54a42b9cf527044d8116ad875519aa31bd6b6bf6e37f01778/PowerShell/PowerShell/issues/8235 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04490c1ea50550c54a42b9cf527044d8116ad875519aa31bd6b6bf6e37f01778/PowerShell/PowerShell/issues/8235 |
| og:image:alt | Steps to reproduce class TestClass { [string] hidden $prop [string]Prop() { return $this.prop } } $obj = [TestClass]::new() Expected behavior Get an error saying you can't have a property and a met... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AlexBillon07 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9ab00cc3b4fa90bbd3da70765dd38efc23cfa9d9b0930e41feea2bf67f60ecaf |
| 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 | 1b795ba060b92691fc16c5a12cf2bf95e83432b4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width