private static Word ConvertToObject(WordXml wordXml) { var word = new Word(); word.Name = wordXml.Name; word.Description = wordXml.Description; word.Tags = wordXml.Tags; List<WordEvent> events = ConvertToObject(wordXml.Events); foreach (WordEvent wordEvent in events) { word.Events.Add(wordEvent); } return word; }
private static WordXml ConvertToXml(Word word) { var wordXml = new WordXml(); wordXml.Name = word.Name; wordXml.Description = word.Description; wordXml.Tags = string.IsNullOrEmpty(word.Tags) ? null : word.Tags; wordXml.Events = new WordEventXml[word.Events.Count]; int idx = 0; foreach (WordEvent wordEvent in word.Events) { wordXml.Events[idx++] = ConvertToXml(wordEvent); } return wordXml; }