This is bizarre... I cannot check to see if an object is null in C# because it is null! What is the point in giving me the opportunity to have IsNullOrEmpty and various other checks if I cannot use them? It gives an error telling me that the object is not set to an instance of an object... this is the very reason why I am doing the check!
I am using the Amazon product advertising API and I am trying to get a price. Some of them do not seem to have a price so I need a check to see if the object exists. It then gives me an error for failing INSIDE the actual IF statement check telling me that it is null! That is the very purpose of the check! As an example:
if(String.IsNullOrEmpty(item.ItemAttributes.ListPrice.FormattedPrice))
{
<p>No Price</p>
}
The only way I can get this to work is by using a try catch. I am being forced to actually produce an exception to get the thing to work. This does not make any sense.