public static List <CardinalPoint> ToList() { var result = new List <CardinalPoint>(); CardinalPoint temp = _start; do { result.Add(temp); temp = temp.Right; } while (!temp.Equals(_start)); return(result); }
private static void Insert(string value, Point direction) { CardinalPoint newCardinalPoint; if (_start == null) { newCardinalPoint = new CardinalPoint { Value = value, Direction = direction }; newCardinalPoint.Right = newCardinalPoint.Left = newCardinalPoint; _start = newCardinalPoint; return; } var last = _start.Left; newCardinalPoint = new CardinalPoint { Value = value, Direction = direction, Right = _start }; _start.Left = newCardinalPoint; newCardinalPoint.Left = last; last.Right = newCardinalPoint; }