Skip to content
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

Initializers are not consistent with when they break #809

Closed
belav opened this issue Jan 28, 2023 · 0 comments · Fixed by #824
Closed

Initializers are not consistent with when they break #809

belav opened this issue Jan 28, 2023 · 0 comments · Fixed by #824
Milestone

Comments

@belav
Copy link
Owner

belav commented Jan 28, 2023

Dictionary and array initializers should be following similar rules to object initializers for when they break

   // breaks if there are more than 2 properties
    var thing = new Thing
    {
        One = "",
        Two = "",
        Three = ""
    };

   // these should all probably be breaking, the nested { make it hard to read even in the last example
    var dictionaryInitializer = new Dictionary<int, string> { { 1, "" }, { 2, "a" }, { 3, "b" } };
    int[,,] cube = { { { 111, 112 }, { 121, 122 } }, { { 211, 212 }, { 221, 222 } } };
    int[][] jagged = { { 111 }, { 121, 122 } };
@belav belav added this to the 0.23.0 milestone Jan 28, 2023
belav added a commit that referenced this issue Feb 13, 2023
* Always break dictionary and array initializers in some cases.

closes #809

* Only break complex initializers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant