IntelliTect / IntelliTect/CodingGuidelines

Add analyzer that flags var in pattern matching

Open
#52 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
12
Forks
16
Avg merge
2m
Merged PRs (30d)
7

Description

Based on internal discussion.
Pattern matching with var provides little value since it effectively matches everything and ends up copying to a local value.

Match on this
```
if ( bar is var foo )
```

Suggested code change (just to help educate people)
```
var foo = bar;
if ( true )
```

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.