Skip to content

Single collection as method parameter #1135

@jods4

Description

@jods4

As formatted by 0.27 in playground

Input:

var dummy = new DestructuringOptionsBuilder()
    .WithDefaultDestructurers()
    .WithDestructurers([
        new FirstDestructurer(),
        new SecondDestructurer(),
        new ThirdDestructurer(),
        new FourthDestructurer(),
    ]);

Output:

var dummy = new DestructuringOptionsBuilder()
    .WithDefaultDestructurers()
    .WithDestructurers(
        [
            new FirstDestructurer(),
            new SecondDestructurer(),
            new ThirdDestructurer(),
            new FourthDestructurer(),
        ]
    );

Expected behavior:
Input seems better to me when there's only a single parameter that is a collection.
Using two lines for single characters [ and ], and increasing indentation, doesn't seem beneficial in this situation.

I note that this is somewhat similar to the idea that for a single lambda parameter x => ..., it's nicer to keep Method(x => rather than putting x => on a line of its own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions