Пример #1
0
 public void Draw()
 {
     InstantiateFields();
     _graphicalObject.Draw();
     // garbage collect heavy object
     _graphicalObject = null;
 }
Пример #2
0
 private void InstantiateFields()
 {
     if (_graphicalObject is null)
     {
         Console.WriteLine("Graphical object is instantiated.");
         _graphicalObject = new GraphicalObject(_imageFilePath);
         _width           = _graphicalObject.ImageWidth();
         _height          = _graphicalObject.ImageHeight();
     }
 }
Пример #3
0
        public int ImageWidth()
        {
            if (_width is null)
            {
                InstantiateFields();
            }
            // garbage collect heavy object
            _graphicalObject = null;

            return(_width.Value);
        }
Пример #4
0
        public int ImageHeight()
        {
            if (_height is null)
            {
                InstantiateFields();
            }
            // garbage collect heavy object
            _graphicalObject = null;

            return(_height.Value);
        }