public void Draw() { InstantiateFields(); _graphicalObject.Draw(); // garbage collect heavy object _graphicalObject = null; }
private void InstantiateFields() { if (_graphicalObject is null) { Console.WriteLine("Graphical object is instantiated."); _graphicalObject = new GraphicalObject(_imageFilePath); _width = _graphicalObject.ImageWidth(); _height = _graphicalObject.ImageHeight(); } }
public int ImageWidth() { if (_width is null) { InstantiateFields(); } // garbage collect heavy object _graphicalObject = null; return(_width.Value); }
public int ImageHeight() { if (_height is null) { InstantiateFields(); } // garbage collect heavy object _graphicalObject = null; return(_height.Value); }