void RenderFunction() { var function = _population.OptimizationFunction; var surface = new ILSurface((x, y) => (float)function.Calculate(x, y), xmin: (float)function.MinX, xmax: (float)function.MaxX, ymin: (float)function.MinX, ymax: (float)function.MaxX, xlen: 100, ylen: 100); if (_currentSurface != null) { _plotCube.Remove(_currentSurface); _currentSurface.Dispose(); } _currentSurface = surface; _plotCube.Add(surface); renderContainer.Refresh(); }