/// <summary> /// Initializes a new instance of the <see cref="DownwardTreeWalk<T>"/> class. /// </summary> /// <param name="initialNode">The initial tree node to start from.</param> /// <param name="selectorFunction">The selector function that is supposed to return a list of children for each node.</param> /// <param name="downwardTreeWalkType">Type of the downward tree walk.</param> public DownwardTreeWalk(T initialNode, Func <T, IEnumerable <T> > selectorFunction, DownwardTreeWalkType downwardTreeWalkType = DownwardTreeWalkType.BreadthFirst) : base(initialNode, selectorFunction) { this.DownwardTreeWalkType = downwardTreeWalkType; }
public static IEnumerable <T> DownwardTreeWalk <T>(this T subject, Func <T, IEnumerable <T> > selectorFunction, DownwardTreeWalkType downwardTreeWalkType = DownwardTreeWalkType.BreadthFirst) where T : class { if (subject == null) { throw new ArgumentNullException("subject"); } return(new DownwardTreeWalk <T>(subject, selectorFunction, downwardTreeWalkType)); }