简体   繁体   中英

Resharper recommending adding argument

I have a piece of code that Resharper is recommending I change.

From this :

var tasks = new List<Task<Tuple<int, ErrorCarrier>>>();
//some code here
Task.WaitAll(tasks.ToArray());

To this :

var tasks = new List<Task<Tuple<int, ErrorCarrier>>>();
//some code here
Task.WaitAll(tasks: tasks.ToArray());

When I investigate the reason for this, Resharper takes me to this page

What am I not understanding? Why would Resharper want to add a named argument?

在此输入图像描述

As discussed in the comments, adding the argument name is not a solution suggested by ReSharper.

ReSharper shows context actions (indicated by hammers) and quick-fixes (indicated by light bulbs). ReSharper is not providing a solution to the code issue here.

The code issue can be solved by providing a Task[] instead of a Task<AnyType>[] to Task.WaitAll which can be achieved by using tasks.OfType<Task>().ToArray() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM