JetBrains Rider
 
Get JetBrains Rider
You are viewing the documentation for an earlier version of JetBrains Rider.

Code Syntax Style: Null checking pattern

Last modified: 31 March 2023

When checking an expression for null with the type-testing 'is' operator, you can choose between two null-checking patterns:

  • Use the 'not null' pattern that makes the expression more readable.

  • Use the object pattern syntax `{ }` that makes the expression more flexible, allowing you to declare a local variable after it.

JetBrains Rider helps you enforce style preferences for null-checking patterns in the existing code and takes your preferences into account when it produces new code with code completion and code generation features, applies code templates and performs refactorings.