public void Add(object content) { AddContent(content); if (_text != null) { if (_parent.content == null) { if (_parent.SkipNotify()) { _parent.content = _text; } else { if (_text.Length > 0) { InsertNode(new XText(_text)); } else { if (_parent is XElement) { // Change in the serialization of an empty element: // from empty tag to start/end tag pair _parent.NotifyChanging(_parent, XObjectChangeEventArgs.Value); if (_parent.content != null) { throw new InvalidOperationException(SR.InvalidOperation_ExternalCode); } _parent.content = _text; _parent.NotifyChanged(_parent, XObjectChangeEventArgs.Value); } else { _parent.content = _text; } } } } else if (_text.Length > 0) { XText prevXText = _previous as XText; if (prevXText != null && !(_previous is XCData)) { prevXText.Value += _text; } else { _parent.ConvertTextToNode(); InsertNode(new XText(_text)); } } } }