public LexEntry Clone() { var clone = new LexEntry(); clone._lexicalForm = (MultiText)_lexicalForm.Clone(); //_lexicalForm and Guid must have been set before _id is set if (_id != null) { clone.GetOrCreateId(false); } clone.OrderForRoundTripping = _orderForRoundTripping; clone._orderInFile = _orderInFile; foreach (var senseToClone in _senses) { clone._senses.Add(senseToClone.Clone()); } foreach (var lexVariantToClone in Variants) { clone.Variants.Add((LexVariant)lexVariantToClone.Clone()); } foreach (var lexNoteToClone in Notes) { clone.Notes.Add((LexNote)lexNoteToClone.Clone()); } foreach (var pronunciationToClone in _pronunciations) { clone._pronunciations.Add((LexPhonetic)pronunciationToClone.Clone()); } foreach (var etymologyToClone in _etymologies) { clone._etymologies.Add((LexEtymology)etymologyToClone.Clone()); } foreach (var keyValuePairToClone in Properties) { clone.AddProperty(keyValuePairToClone.Key, keyValuePairToClone.Value.Clone()); } return(clone); }