Language Features
These best practices relate to usage of language-level features.
The C# version in which the feature was introduces is listed below for two reason:
- Not everyone is using the latest version of C#
- The longer a language feature has been around, the more developers should be familiar with it
Feature | C# Version | Rules |
---|---|---|
Inline variable declaration | 7.0 | IDE0018 |
Null-conditional operator | 6 | IDE1005 |
- With delegate invocation | 6 | IDE1005 |
Object and collection initializers | 3 | IDE0017, IDE0028 |
Pattern matching | 7.0 - 8 | IDE0019 |
- Over as with null check | 7.0 | IDE0019 |
Throw expressions | 7.0 | IDE0016 |
Type keywords | 1 | IDE0049 |