New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Join-String does not produce the same result as -join #8632
Comments
I don't think this is really avoidable. By the time the cmdlet receives input, the |
Any evidence to support this claim? function My-Join-String { @($input) -join ', ' }
[C]::new(), [C]::new(), [C]::new() | My-Join-String |
@PetSerAl Ah, I see! Okay, I misunderstood the original point. Looks like it's enumerating each pipeline item, likely in an attempt to make pipeline input behave the same as @mklement0 and I have discussed this a bit and have a code pattern that could help rectify it outlined in #4242 as you've seen. |
@vexx32 If it enumerating each pipeline item, the it should produce |
Not quite. It calls the enumerator of your object to enumerate it, and receives back a two element array for each item. It doesn't then enumerate each of those arrays, that would be an extra level of enumeration. 🙂 I would guess that somewhere in its logic it converts these either implicitly or explicitly to string, which presumably forces PS to call |
That is the problem. |
Are other cmdlets affected by this? |
I don't think a lot of cmdlets will be. Most cmdlets implement There may be some, but I don't know of any affected in the same way as this one is... Yet 😄 |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
2 similar comments
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
Steps to reproduce
Expected behavior
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: