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

Single element arrays should not span multiple lines #603

Closed
franzalex opened this issue May 17, 2015 · 0 comments
Closed

Single element arrays should not span multiple lines #603

franzalex opened this issue May 17, 2015 · 0 comments
Labels
C# Enhancement Areas for improvement Output Output code formatting; hyperlinks/tooltips on output code
Milestone

Comments

@franzalex
Copy link

I think that arrays that contain just one element should not span multiple lines. The current implementation splits the generated code into a minimum of three lines.

Real code (Desired output)

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(string.Join(".", new string[] { "abc"}));  // all on one line
    }
}

Decompiled Code (Current output)

internal class Program
{
    private static void Main(string[] args)
    {
        Console.WriteLine(string.Join(".", new string[] // 
        {                                               // array declaration spans
            "abc"                                       // multiple lines
        }));                                            // 
    }
}

Optionally, the code can be split over multiple lines if the number of characters exceeds a certain limit (80, for example). That way, shorter arrays appear on one line for brevity while longer ones span multiple lines to improve readability.

@siegfriedpammer siegfriedpammer added C# Enhancement Areas for improvement Output Output code formatting; hyperlinks/tooltips on output code labels Aug 10, 2019
@siegfriedpammer siegfriedpammer added this to the v7.0-p2 milestone Jan 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C# Enhancement Areas for improvement Output Output code formatting; hyperlinks/tooltips on output code
Projects
None yet
Development

No branches or pull requests

2 participants