Inquiries about when an object is destroyed

Viewed 27
     switch ((CellMode)btn.BtnID)
                {
                    case CellMode.Single:
                        {      
                            xMainContents.Children.Clear();
                            using (SingleMode single = new SingleMode())
                            {
                                xMainContents.Children.Add(single);
                            }
    
                            break;
                        }
                    case CellMode.Multi:
                        {     
                            xMainContents.Children.Clear();
                            xMainContents.Children.Add(m_MultiModel);
                            break;
                        }
                }



public partial class SingleMode : ContentView, IDisposable
    {
        public SingleMode()
        {
            InitializeComponent();
        }

        ~SingleMode()
        {

        }

        public void Dispose()
        {
            
        }
    }

When the xMainContents.clear() function is called, all objects inside are destroyed?

It is not called when testing. If you leave the using statement, Dispose is called, and the question is destroyed after Children.Add(), and the screen appears. Since I only used C++, I have a question about the process of destruction.

To summarize the question, is it destroyed when clear is called?

0 Answers
Related