I'm getting System.NullReferenceException: Object reference not set to an instance of an object. Exception with below code.
   string avblCount = "0";
    if (!string.IsNullOrWhiteSpace(item.PART_AVAILABILITY.AVAIL_COUNT.ToString() as string))
    {
         avblCount = item.PART_AVAILABILITY.AVAIL_COUNT.ToString();
    }
Exception occurred from this line.
if (!string.IsNullOrWhiteSpace(item.PART_AVAILABILITY.AVAIL_COUNT.ToString() as string))
How can i fix this ?
 
    