Alex Rivera | Logout

What is the best way to iterate through a strongly-typed generic List<T>?

Asked 2008-08-18T20:49:22.443
17

What is the best way to iterate through a strongly-typed generic List in C#.NET and VB.NET?

Edit
Report

1 Answer

33

For C#:

foreach(ObjectType objectItem in objectTypeList)
{
    // ...do some stuff
}

Answer for VB.NET from Purple Ant:

For Each objectItem as ObjectType in objectTypeList
    'Do some stuff '
Next
answered 2008-08-18T20:52:25.980

Your Answer