Title: Why is ([System.Collections.ObjectModel.Collection[psobject]]1)[0] a string? · Issue #7154 · PowerShell/PowerShell · GitHub
Open Graph Title: Why is ([System.Collections.ObjectModel.Collection[psobject]]1)[0] a string? · Issue #7154 · PowerShell/PowerShell
X Title: Why is ([System.Collections.ObjectModel.Collection[psobject]]1)[0] a string? · Issue #7154 · PowerShell/PowerShell
Description: I've been using this conversion to pass objects to PowerShell.Invoke() like this: PowerShell.Invoke([System.Collections.ObjectModel.Collection[psobject]]$obj) I'm puzzled by this conversion from [int32] to [string]. Steps to reproduce ([...
Open Graph Description: I've been using this conversion to pass objects to PowerShell.Invoke() like this: PowerShell.Invoke([System.Collections.ObjectModel.Collection[psobject]]$obj) I'm puzzled by this conversion from [i...
X Description: I've been using this conversion to pass objects to PowerShell.Invoke() like this: PowerShell.Invoke([System.Collections.ObjectModel.Collection[psobject]]$obj) I'm puzzled by this conversion...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/7154
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Why is ([System.Collections.ObjectModel.Collection[psobject]]1)[0] a string?","articleBody":"I've been using this conversion to pass objects to `PowerShell.Invoke()` like this:\r\n```PowerShell\r\nPowerShell.Invoke([System.Collections.ObjectModel.Collection[psobject]]$obj)\r\n``` \r\nI'm puzzled by this conversion from `[int32]` to `[string]`.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\n([System.Collections.ObjectModel.Collection[psobject]]1)[0].GetType().Name\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nI expected `1` to remain an `[int32]`.\r\n\r\n```none\r\nint32\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n`1` is converted to a `[string]`\r\n\r\n```none\r\nstring\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-preview.688\r\nPSEdition Core\r\nGitCommitId v6.1.0-preview.688\r\nOS Microsoft Windows 6.3.9600\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/alx9r","@type":"Person","name":"alx9r"},"datePublished":"2018-06-23T17:31:00Z","url":"https://github.com/PowerShell/PowerShell/issues/7154"}
| 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:fc8af0a6-2ca2-bd4a-fac3-7f63e548612d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6F8:11BFC:2A0B434:3AAE8F8:6AFD5C35 |
| html-safe-nonce | dfa96bf35f96f5152e40aa95584d7daef4420050840f86e81053e151fd73f0b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkY4OjExQkZDOjJBMEI0MzQ6M0FBRThGODo2QUZENUMzNSIsInZpc2l0b3JfaWQiOiI5MTkzMDA2Njg4NTg2NTIxNjUzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9f0e9c09d2d7ecfe44ec8de003545cc3570f37246e02835b94403e423d5ed25c |
| hovercard-subject-tag | issue:335117715 |
| 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/7154/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e631fa6db467e7dbe1e4bb17b416ac1ed1961a43066b60732b74d7952d986421/PowerShell/PowerShell/issues/7154 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e631fa6db467e7dbe1e4bb17b416ac1ed1961a43066b60732b74d7952d986421/PowerShell/PowerShell/issues/7154 |
| og:image:alt | I've been using this conversion to pass objects to PowerShell.Invoke() like this: PowerShell.Invoke([System.Collections.ObjectModel.Collection[psobject]]$obj) I'm puzzled by this conversion from [i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alx9r |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| 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 | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width