dotnet / roslynator

Roslynator is a set of code analysis tools for C#, powered by Roslyn.

Home Page:https://josefpihrt.github.io/docs/roslynator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`RCS1250` fixer cannot handle collection expressions

RenderMichael opened this issue · comments

Product and Version Used:

4.10.0

Before

internal static string[] NotNull(string[]? values)
{
    return values ?? [];
}

After

internal static string[] NotNull(string[]? values)
{
    return values ?? new string[];
}

Before

internal static string[] MakeNew()
{
    string[] values = [];

    return values;
}

After

internal static string[] MakeNew()
{
    string[] values = new string[]();

    return values;
}

Before

internal static string[] MakeNew()
{
    string[] values = ["a", "b", "c"];

    return values;
}

After

internal static string[] MakeNew()
{
    string[] values = new string[]() { "a", "b", "c" };
    return values;
}