Improve S3247: Rule should recommend pattern matching for new C# instead of as #2120
Labels
Area: C#
C# rules related issues.
Sprint: Hardening
Fix FPs/FNs/improvements
Type: Rule rework
Change rule behavior
Milestone
Description
Currently, when the rule detects a
is
check in anif
followed by a cast, it raises an issue recommending toReplace this type-check-and-cast sequence with an 'as' and a null check.
. While this is still relevant it makes more sense for modern applications to suggest to use pattern matching instead.Repro steps
https://sonarcloud.io/project/issues?id=sonarlint-visualstudio&issues=AWMB0jMemtQEh111EJCu&open=AWMB0jMemtQEh111EJCu
TODO
When implementing this rule consider also #223
The text was updated successfully, but these errors were encountered: