Michael Cort

Michael Cort

  • NA
  • 6
  • 3.8k

Enumerate an object in an ArrayList by index

Mar 26 2012 3:15 PM
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)