0👍
Ok, so for anyone interested I went with this method. I initially wanted to avoid looping over the array until I realised that 2D arrays don’t implement IEnumerable and I was doing a half-way method but then just decided to go with this.
public IEnumerable<BubbleDataPoint> GridToDataPoints()
{
for (int x = 0; x < grid.GetLength(0); x++)
{
for (int y = 0; y < grid.GetLength(1); y++)
{
yield return new BubbleDataPoint(Convert.ToDouble(x), Convert.ToDouble(y), Convert.ToDouble(grid[x, y]));
}
}
}
Source:stackexchange.com