/* Copyright 2007-2013 The NGenerics Team (https://github.com/ngenerics/ngenerics/wiki/Team) This program is licensed under the GNU Lesser General Public License (LGPL). You should have received a copy of the license along with the source code. If not, an online copy of the license can be found at http://www.gnu.org/copyleft/lesser.html. */ using System.Collections.Generic; namespace NGenerics.Patterns.Visitor { /// /// A visitor that tracks (stores) keys from KeyValuePAirs in the order they were visited. /// /// The type of the keys for the items to be visited. /// The type of the values for the items to be visited. internal sealed class KeyTrackingVisitor : IVisitor> { #region Globals private readonly List tracks; #endregion #region Construction /// public KeyTrackingVisitor() { tracks = new List(); } #endregion #region Public Members /// /// Gets the tracking list. /// /// The tracking list. public IList TrackingList { get { return tracks; } } #endregion #region IVisitor> Members /// public void Visit(KeyValuePair obj) { tracks.Add(obj.Key); } /// public bool HasCompleted { get { return false; } } #endregion } }