looping through the values of an ArrayList in C#

mheavers picture mheavers · Sep 27, 2012 · Viewed 81.8k times · Source

I'm trying to figure out what sort of information these messages contain that are being streamed via OSC. The messages are being stored to an ArrayList. Here is the code:

public void OSCMessageReceived(OSC.NET.OSCMessage message){ 
        string address = message.Address;
        ArrayList args = message.Values;
}

How do I loop through the values of the arrayList args to output its contents?

Answer

Aghilas Yakoub picture Aghilas Yakoub · Sep 27, 2012

you can try with this code

foreach(var item in args )
{
  Console.WriteLine(item);
}