I am wondering whether there is a difference in performance between these two if-statements:
if(myObject != null && myObject.someBoolean)
{
// do something
}
if (myObject?.someBoolean ?? false)
{
// do something
}
If there is a difference in performance, in favor of which approach and why?
Edit: This is not a bottleneck in my application, I am not trying to over-optimize, I am simply curious.
When the code will be compiled, both if-statements will be the same. You can easily check it with sharplab.io