I have an arraylist which has a class datastructure.
public class empRec
{
public string nuView;
public string firstName;
public string position;
}
empRec records = new empRec();
...
...
bar.add(records);
now if i want to access the elements i can use
foreach(empRec foo in bar) { ... }
this allows me to print out the values in my class.
I do not know how to make this work using a for loop.
My end goal being to traverse the arraylist and find employee records and change some of the values.
For example, if employeeNum is equal to the previous employeeNum check position id and change the position id.
forloop? Aforeachshould be fine so long as you aren't changing the collection but only the properties of the objects in the collection. Could you provide some code snippets of what you are trying to do in theforloop?