Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public DoubleLink SwapLinkWithNext(DoubleLink link)
- {
- DoubleLink next = link.Next;
- if (next == null)
- {
- return null;
- }
- DoubleLink previous = link.Previous;
- DoubleLink current = link;
- DoubleLink nextNext = next.Next;
- current.Next = next.Next;
- current.Previous = next;
- next.Previous = previous;
- next.Next = current;
- if (previous == null)
- {
- First = next;
- } else {
- previous.Next = next;
- }
- if (nextNext == null)
- {
- Last = current;
- } else {
- nextNext.Previous = current;
- }
- return next;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement