iterating thru a typedList

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 28-Sep-2007 18:40:22   

version 1.0.2005.1 final (self-servicing) VS2005 asp.net 2.0


hiya,

I need to iterate thru all the rows in a typedList and concatenate them into a string. I don’t know if there’s a built in way to do this, but if not, I’ll have to iterate thru the typedList.

TListDogTitleTypedList currTitles = new TListDogTitleTypedList()

foreach  TblDogTitleEntity ???? in currTitles

I know that I need a foreach statement, but I don’t know what I use to contain the values.

Can anyone help?

Cheers,

yogi

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Sep-2007 05:10:33   

Hi yogi, _TypedLists _are typed DataTables. _TListDogTitleTypedList _(that inherits from DataTable) has elements of type _TListDogTitleRow _(that inherits from DataRow). So you can iterate in any of these ways:

foreach (ListDogTitleRow listdogRow in currTitles)
{
    Console.WriteLine("{0}", listdogRow.AnyFieldMappedField);
    ...
}

OR


foreach (DataRow r in productsTL)
{
    Console.WriteLine("{0}", r[0]);
    ...
}

Cheers,

David Elizondo | LLBLGen Support Team
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 03-Oct-2007 13:13:01   

Hiya David.

Thanks for the help.

yogi