I have this line of code that can throw null exceptions.
singleAddress.FullAddress = cc.MailingAddressStreet1.ToString() + " " +
cc.MailingAddressCity.ToString() + " " +
cc.MailingAddressState.ToString() + " " +
cc.MailingAddressZip.ToString() + " " +
cc.MailingAddressCountry.ToString();
I know that I can fix it by adding if statements to check if it is null. But is there a better recommended way to do it?
I just want to learn how to handle such exceptions better (and not have to write more code than I need to). Thanks in advance.