public void Add(string section, string itemId) { if (Sections == null) { Sections = new List <FavoritesSection>(); } var targetSection = Sections.FirstOrDefault(s => s.Name == section); if (targetSection == null) { targetSection = new FavoritesSection { Name = section, ItemsId = new List <string>() }; Sections.Add(targetSection); } targetSection.ItemsId.Add(itemId); }
public void Add(string section, string itemId) { if (Sections == null) { Sections = new List<FavoritesSection>(); } var targetSection = Sections.FirstOrDefault(s => s.Name == section); if (targetSection == null) { targetSection = new FavoritesSection { Name = section, ItemsId = new List<string>() }; Sections.Add(targetSection); } targetSection.ItemsId.Add(itemId); }