Roslyn: Analyzer for Foreach loop to LINQ

Created on 4 Feb 2020  路  6Comments  路  Source: dotnet/roslyn

Area-Analyzers Blocked Feature Request help wanted

Most helpful comment

we already have refactoring , needs to convert to an analyzer

All 6 comments

we already have refactoring , needs to convert to an analyzer

Design meetings notes:
Dependency on https://github.com/dotnet/roslyn/issues/32461

Customer ask was to be able to set the severity and find all places it can possibly be invoked.

Note: This is not always a safe refactoring to apply as it can fail or cause perf regressions. We have heuristics that might change on where this refactoring will be successful so if the severity is affected by those heuristics it may appear or disappear depending on their code changes.

This is blocked on #32461. As soon as the feature is supported, this will move to up-for-grabs.

Adding additional related customer feedback:

VS will never suggest such things. Having such hints improved a lot my knowledge about LINQ statements:

image

@mikadumont I would file this as a new analyzer request. I do not think this is related to foreach-to-LINQ

Adding additional related customer feedback:

VS will never suggest such things. Having such hints improved a lot my knowledge about LINQ statements:

image

Good one, it is one the most frequently used code snippet

Was this page helpful?
0 / 5 - 0 ratings