namespace Semantics3API { public class Offers { public string SellerName { get; set; } public string Price { get; set; } public string Currency { get; set; } public string Availability { get; set; } } // public class Stores { public string SkuInStore { get; set; } public string ProductUrlInStore { get; set; } public List<Offers> Offers { get; set; } } // public class Images { public string imageUrl; } // public class Product { public string Title { get; set; } public List<Images> Images { get; set; } public List<Stores> Stores { get; set; } } }
And here is the error null reference
Stores store = new Stores(); store.SkuInStore = skuInStore; store.ProductUrlInStore = productUrlInStore; Offers offer = new Offers(); offer.SellerName = sellerName; offer.Price = price; offer.Currency = currency; offer.Availability = availability; //adding offer to store store.Offers.Add(offer); // object reference not set to instance of object error :(
public class Stores { public Stores() { Offers = new List<Offers>(); } public string SkuInStore { get; set; } public string ProductUrlInStore { get; set; } public List<Offers> Offers { get; set; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)