/// <summary> /// Prepends the given <see cref="ChainedSerializer"/> to this serializer. /// </summary> /// <param name="previousSerializer">The serializer to prepend.</param> public void Prepend([CanBeNull] ChainedSerializer previousSerializer) { // Update current Prev if non-null to target the first of the chain we're prepending Prev?.SetNext(previousSerializer?.First); previousSerializer?.First.SetPrev(Prev); // Set the current Prev to the given serializer Prev = previousSerializer; // Make sure that the link with the old Next of the given serializer is cleared previousSerializer?.Next?.SetPrev(null); // And set the Next of the given serializer to be this one. previousSerializer?.SetNext(this); }
public void LinkRemove() { if (Prev != null) { Prev.SetNext(Next); } if (Next != null) { Next.SetPrev(Prev); } SetNext(null); SetPrev(null); }
public void Pop() { Prev?.SetNext(END.Next); END.Next?.SetPrev(Prev); }