Esempio n. 1
0
 /// <summary>
 /// Appends the given <see cref="ChainedSerializer"/> to this serializer.
 /// </summary>
 /// <param name="nextSerializer">The serializer to append.</param>
 public void Append([CanBeNull] ChainedSerializer nextSerializer)
 {
     // Update current Next if non-null to target the last of the chain we're appending
     Next?.SetPrev(nextSerializer?.Last);
     nextSerializer?.Last.SetNext(Next);
     // Set the current Next to the given serializer
     Next = nextSerializer;
     // Make sure that the link with the old Prev of the given serializer is cleared
     nextSerializer?.Prev?.SetNext(null);
     // And set the Prev of the given serializer to be this one.
     nextSerializer?.SetPrev(this);
 }
Esempio n. 2
0
 /// <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);
 }
Esempio n. 3
0
 private void SetNext(ChainedSerializer next) => Next = next;
Esempio n. 4
0
 private void SetPrev(ChainedSerializer prev) => Prev = prev;