Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IsNullEnforcer

This Roslyn Analyzer was inspired by this tweet.
It searches for conditions in your code which perform null checks using the "==" or the "!=" operator and forces you to use the "is" or "is not" patterns instead. Here's an example:

using System;

string? s = null;
if (s == null) {
    Console.WriteLine("Is null!")
}

The condition would be highlighted as an error and a code fix would be offered, changing the code to s is null.

Disclaimer: I am not saying this is a good idea and/or should be included in every code base. This is just a demonstration to show what is possible.

About

Roslyn Analyzer which enforces the usage of 'is null' and 'is not null' over '== null' and '!= null'.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages