private static void AddToListBeforeNode(TimeEvent pNewNode, TimeEvent pNextNode) { // Set new node pointers pNewNode.SetNext(pNextNode); pNewNode.SetPrev(pNextNode.GetPrev()); if (pNextNode.GetPrev() != null) { // Set previous node pointer pNextNode.GetPrev().SetNext(pNewNode); } // Set next node pointer pNextNode.SetPrev(pNewNode); }