Skip to content

Array splatting flattening jagged arrays #13045

@santisq

Description

@santisq

Prerequisites

  • Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Document new Get-Foo cmdlet" instead of "New cmdlet."

PowerShell Version

7.6

Summary

Hey guys, I came across this feature about array splatting for binaries, essentially flattening them, and was wondering if it perhaps should be documented in about_splatting?#splatting-with-arrays:

$code = @'
using System;

for (int i = 0; i < args.Length; i++)
    Console.WriteLine($"[{i}]: {args[i]}");
'@

$arguments = 1, (2, 3), 4

$code | dotnet run - -- $arguments
# [0]: 1
# [1]: 2 3
# [2]: 4

$code | dotnet run - -- @arguments
# [0]: 1
# [1]: 2
# [2]: 3
# [3]: 4

Details

No response

Proposed Content Type

About Topic

Proposed Title

No response

Related Articles

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue-doc-ideaIssue - request for new contentneeds-triageWaiting - Needs triage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions