I have a Java code block like following:

Vector<NameAddress> route = dialog.getRoute(); 
for ( Enumeration<NameAddress> e = route.elements(); e.hasMoreElements(); ) {
    // some more to copy route to another Vector<>
    }

I am trying to convert it in C# and here is my code:

List<NameAddress> route = dialog.getRoute();
for ( IEnumerable<NameAddress> e = route.All; e.hasMoreElements(); ) {
    // some more to copy route to another List<>
    }

How can I solve the Enumeration part in c# ?

Use can use a foreach for all IEnumerables (like List)

List<NameAddress> route = dialog.getRoute();
foreach(NameAddress nameAddress in route)
{
    //some more to copy rout to another List<>
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.