Well, if we add the id/refid stuff we've been talking about, this would dovetail nicely with that - just pass in an ID to an element that supports IEnumerable.
<foreach itemtype="Element" source="<element_id>" > property="item"> <echo message="${item}"/> </foreach> --- Scott Hernandez <[EMAIL PROTECTED]> wrote: > And we would call .ToString() on each iteration for > the property value? > I'm fine with that. > > But what would the xml look like? > > <foreach itemtype="IEnumarable" source="???" > property="item"> > <????> > <echo message="${item}"/> > </> > > Really the question is how we would get that object > to the foreach. It > would need to be embedded, or referenced. Right now > a Target is the only > reference-able type. > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > [mailto:nant-developers- > > [EMAIL PROTECTED]] On Behalf Of Kevin > Dente > > Sent: Monday, June 24, 2002 1:53 PM > > To: Scott Hernandez; > [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: RE: [nant-dev] Loop Task > > > > Sorry if I'm getting too crazy here, but how about > > making elements like FileSet implement > IEnumerable, > > and have the foreach task capable of iterating > over > > anything that implements that interface? > > > > That way you don't need to update the foreach task > to > > add a new element - to make any element > for-each-able, > > just add an IEnumerable implementation to the > element. > > I've been working on a FileList class - it would > work > > for that also. And OptionSet if we decide to keep > it. > > > > --- Scott Hernandez <[EMAIL PROTECTED]> wrote: > > > What would you think the xml would look like? > > > > > > <foreach itemtype="fileset" source="<id>" > > > property="item"> > > > <echo message="${item}"/> > > > </foreach> > > > > > > BTW. I've now got the embedded version working. > > > <foreach itemtype="Folders" source="c:\" > > > property="currDir"> > > > <echo message="${currDir}"/> > > > </foreach> > > > > > > It works; after the first compile and > everything. > > > > > > I will commit the abstract TaskWithEmbeddedTasks > > > class later today. This > > > abstract class will evaluate all internal > elements > > > as tasks. It skips > > > anything with a BuildElementAttribute, or that > is in > > > a special list of > > > excluded element names. The LoopTask now derives > > > from this. > > > > > > > > > Does anyone have an argument as to whether this > > > should go into the NAnt > > > core or NAntContrib? I'm leaning towards core. > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Nant-developers mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-developers __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ NAntContrib-Developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer