luizfbicalho
(Luiz Fernando Bicalho)
1
Imagine this class
public class Base
{
public Child Child {get;set;} = new Child();
}
public class Child
{
public string Description {get;set;} = string.Empty;
}
and in my code I have
var x = new Base();
var d = x.Child?.Description;
How can I show a message that this ?. is not necessary because it can’t be null?
1 Like
Hey @luizfbicalho
Thanks for the suggestion, it’s a very good one.
I made an issue about this on sonar-dotnet, which you can find here
It will be considered and taken care of during an upcoming sprint about similar, null-tracking rules.
Regards,
Greg
3 Likes
Thanks for the answer, I added some more information in the issue
2 Likes
system
(system)
Closed
10
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.