Skip to content

Maybe support collection expression syntax for TheoryData #2836

@FreeApophis

Description

@FreeApophis

TheoryData is a collection type, it implements the old Pattern to initialize it (Add) so it would be convinient if it would support the C#12's collection expression syntax as well.

Currently:

    public static TheoryData<string> NumberStrings()
        => new() { string.Empty, "no number", "-12", "0"};

Proposed:

public static TheoryData<string> NumberStrings()
    => [string.Empty, "no number", "-12", "0"];

The implementation would require the implementation of a simple Collection Builder.

The other theoretical advantage to the old pattern is the support of immutable collections, but we don't have that in this case.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalThe issue is caused by an external party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions