public void AddLocalizedEntry(string language, string href, string value) { var lang = (this.Languages ?? (this.Languages = new List <ElementLocalizationLanguage>())).FirstOrDefault(l => l.Lang.Equals(language, StringComparison.OrdinalIgnoreCase)); if (lang == null) { lang = new ElementLocalizationLanguage { Lang = language }; this.Languages.Add(lang); } var entries = lang.Entries ?? (lang.Entries = new List <ElementLocalizationEntry>()); var entry = lang.Entries.FirstOrDefault(e => e.Href.Equals(href, StringComparison.OrdinalIgnoreCase)); if (entry == null) { entry = new ElementLocalizationEntry { Href = href }; entries.Add(entry); } entry.Value = value; }
public void AddLocalizedEntry(string language, string href, string value) { var lang = (Languages ?? (Languages = new List<ElementLocalizationLanguage>())).FirstOrDefault(l => l.Lang.Equals(language, StringComparison.OrdinalIgnoreCase)); if (lang == null) { lang = new ElementLocalizationLanguage {Lang = language}; Languages.Add(lang); } var entries = lang.Entries ?? (lang.Entries = new List<ElementLocalizationEntry>()); var entry = lang.Entries.FirstOrDefault(e => e.Href.Equals(href, StringComparison.OrdinalIgnoreCase)); if (entry == null) { entry = new ElementLocalizationEntry {Href = href}; entries.Add(entry); } entry.Value = value; }