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.
Loading

VulpesRank #55 · 29.2K reputationPosted Mar 26, 2012, 11:37 AM EDT
Michael Cort6 reputationPosted Mar 26, 2012, 11:41 AM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 26, 2012, 11:57 AM EDT
Here's a simple example I've just thrown together:
If list were an ArrayList instead, then you'd need to cast to mp3 before you could apply the indexer which makes the code rather ugly: