dotnet / dotnet/roslynator

Suggestion: new analyzer for replacing new Func<>(lambda) to lambda

Open
#443 0 comments 0 reactions 0 assignees View on GitHub
Area-Analyzers Feature Request
Dominant language
C#
Stars
3.5k
Forks
294
Avg merge
2h 30m
Merged PRs (30d)
4

Description

Can you provide an analyzer that would replace:
`var squareFunc = new Func(x => x*x);`
or
`Func squareFunc = new Func(x => x*x);`
into
`Func squareFunc = x => x * x;`

That is to remove the `new` call and instead have the lambda be typed through the type of the assigned variable.

(and of course the same for any `Func<>`, `Action<>` or other delegate types)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.