you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 2 weeks ago (1 child)

Seriously, it's EXACTLY as verbose as the thing it's trying to replace. What problem does this solve?

How is it as verbose? It can replace multiple lines of Adds with a single bracketed expression

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 2 weeks ago

    You mean like the "single bracketed expression" syntax we've had since... hell, I don't even know, C#4?

    List<string> items =
    [
        new(capacity: 10),
        "First",
        "Second",
        "Third"
    ];
    
    var items = new List<string>(capacity: 10)
    {
        "First",
        "Second",
        "Third"
    };
    
  • source
  • parent