I have an ArrayList that I add elements to via a class like so:
...
private ArrayList myList;
...
public void ListManager()
{
myList.Add(new MyData(myTag, Close[0], myX, Close[0]));
}
public class MyData
{
public string tag;
public double price;
public double x;
public double y;
public MyData()
{
}
public MyData(string tag, double price, double x, double y)
{
this.tag = tag;
this.price = price;
this.x = x;
this.y = y;
}
}
Ok, when I iterate using a foreach loop:
foreach (object o in myList)
{
Print(o.ToString());
}
My output is:
NinjaTrader.Indicator.MyMarketProfile3+MyData
It is giving me what I requested, which is the MyData object, however, I would like to access the vars within MyData like so:
MyData.tag;
MyData.price;
etc.
I've tried o.tag; o.price;
...I can't for the life of me find out the correct syntax! Please shed light.
Comment