If there’s really a business reason to cater for the situation where your variable
is null
, then you the developer should provide an else
block.
Concerning literature, yes there is actually a performance cost to throwing exceptions, so it’s recommended you avoid your app throwing exceptions as much as possible. You can read more about it on MSDN.
2
solved What is the correct fix instead of using if ( variable != null ) to bypass the origin of issue [closed]