Пример #1
0
        private bool _isMouseDown = false;              // this is the left mouse button

        #endregion

        #region Constructor

        public VectorPanel()
        {
            InitializeComponent();

            displayItem1.Text = _vector.ToString(0);
            displayItem2.Text = "Length = 0";
        }
Пример #2
0
        /// <summary>
        /// Using strung Using Dispase() and "using" statement
        /// </summary>
        private void managingMemory( )
        {
            Trace.WriteLineIf(ts.TraceInfo, "Trace: Call managingMemory()");

            MyVector v1 = new MyVector(2, -3);
            MyVector v2 = new MyVector(4, 7);
            MyVector v3 = v1 + v2;

            tbTopLeft.Text = $"{v1.ToString( )} + {v2.ToString( )} = {v3.ToString( )}";

            ManageMemory m1 = new ManageMemory();
            ManageMemory m2 = new ManageMemory();

            // Call Dispose to deallocate resourses
            m2.Dispose( );

            using (ManageMemory m3 = new ManageMemory( )) {
                tbTopRight.Text = "m3 instance will be deallocated then";
            }
        }