i have a user defined list
public class Level2
{
public double price { get; set; }
public int size { get; set; }
public Level2(double price, int size)
{
this.price = price;
this.size = size;
}
}
in my program i have this snippet which i loop through the first 10 elements
List<Level2> bid = new List<Level2>();
for (int i = 0; i < 10; i++)
{
if (i < bid.Count && bid[i].price > bid[0].price - (20 * process.tickSize))
{
bidString = bidString + "," + bid[i].price.ToString() + "," + bid[i].size.ToString();
}
}
and it compile and runs fine.
Now i need to expand my program and want to change my variable to an array type, like this:
List<Level2>[] bid = new List<Level2>[5];
how can i change my loop, so i can loop through the first array, ie bid[0] ?
please provide some working snippet, thank you very much
Replace all bid with bid[0]
Alternatively use a different variable for the bid array
then assign bid to be the first element
and then continue with your existing code.