roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Feature Request: Remove unnecessary array declaration in params parameter

Open nnpcYvIVl opened this issue 6 years ago • 2 comments
trafficstars

May I request a feature that removes unnecessary array declarations in a params parameter?

For example in the following context

static class Program
{
    static void M()
    {
        Sum(new int[] { 1, 2, 3 });
        Sum(1, 2, 3);
    }

    static int Sum(params int[] values) => values.Sum();
}

Offer to change this Sum(new int[] { 1, 2, 3 });

To this Sum(1, 2, 3);

nnpcYvIVl avatar Jan 07 '19 16:01 nnpcYvIVl