24 lines
609 B
Plaintext
24 lines
609 B
Plaintext
The variable `myObject` is equal to `{null-keyword}`, meaning it has no value:
|
|
|
|
[source,csharp,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
public void Method()
|
|
{
|
|
object myObject = null;
|
|
Console.WriteLine(o.ToString()); // Noncompliant: 'myObject' is always null
|
|
}
|
|
----
|
|
|
|
The parameter `input` might be `{null-keyword}` as suggested by the `if` condition:
|
|
|
|
[source,csharp,diff-id=2,diff-type=noncompliant]
|
|
----
|
|
public void Method(object input)
|
|
{
|
|
if (input is null)
|
|
{
|
|
// ...
|
|
}
|
|
Console.WriteLine(input.ToString()); // Noncompliant: the if condition suggests 'input' might be null
|
|
}
|
|
---- |