/// <summary> /// Adds the specified content immediately after this token. /// </summary> /// <param name="content">A content object that contains simple content or a collection of content objects to be added after this token.</param> public void AddAfterSelf(object content) { if (_parent == null) { throw new InvalidOperationException("The parent is missing."); } _parent.AddInternal((Next == null), this, content); }
public void AddAfterSelf(object content) { if (_parent == null) { throw new InvalidOperationException("The parent is missing."); } int num = _parent.IndexOfItem(this); _parent.AddInternal(num + 1, content); }
/// <summary> /// Replaces this token with the specified token. /// </summary> /// <param name="value">The value.</param> public void Replace(JToken value) { if (_parent == null) { throw new InvalidOperationException("The parent is missing."); } JContainer parent = _parent; JToken previous = this; while (previous._next != this) { previous = previous._next; } if (previous == this) { previous = null; } bool isLast = (this == _parent.Last); Remove(); parent.AddInternal(isLast, previous, value); }