3
Answers

Enumerate an object in an ArrayList by index

Michael Cort

Michael Cort

12y
1.4k
1
I have an ArrayList of objects.  This is sort of a quick and dirty thing, so the objects are not a class, just defined by  a statement like

 struct mp3
    {
        public string FileNm;
        public int RecNum ;       
        ...

     }

My question is can I access the individual elements of the object using an index rather that name?

For example, instead of ArrayList1[44].FileNm I want to use ArrayList1[44][0] or something like that. 

This is so I can use a loop to quickly go through all elements of the struct. 



Answers (3)