Is there any mechanism in c# to ignore List if its null?
public class VehicleResponse 
  {
        public Pagination pagination { get; set; }
        public Vehicles data { get; set; }        
        public Include include { get; set; }
    }
Here Include class property might be null. If it's null then i want to ignore that property.
 public class Include
    {
        
        public List<Devices> devices { get; set; }
        public List<Institutions> institutions { get; set; }
        public List<Cars> cars{ get; set; }
    }
This is the class of include. If any List like devices or institution or cars is null then it should ignored.
I don't want to display null value in my json response. If they null just ignore them.
 
     
    