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

Code Inspection: Multiple nullable attributes usage

Last modified: 07 April 2022

NotNull and CanBeNull attributes can be used to indicate whether or not a parameter or a return value can be null. But consider the following code:

public void SetName([CanBeNull][NotNull]string name)
{
  myName = name;
}

This annotation does not make much sense since the two assertions contradict each other.