Esempio n. 1
0
        public void Sample1()
        {
            var us1 = new UsingStatement1();
            var us2 = new UsingStatement2();

            us2.PrintMessage();
            us1.PrintMessage();
        }
Esempio n. 2
0
        public void OldSample()
        {
            using (var us1 = new UsingStatement1())
            {
                using (var us2 = new UsingStatement2())
                {
                    us2.PrintMessage();
                }

                us1.PrintMessage();
            }
        }
Esempio n. 3
0
        public void Sample()
        {
            using var us1 = new UsingStatement1();

            using var us2 = new UsingStatement2();
            us2.PrintMessage();
            us1.PrintMessage();

            Debug.WriteLine("Last");

            Debug.WriteLine("Last");
            Debug.WriteLine("Last");
            Debug.WriteLine("Last");
            Debug.WriteLine("Last");
            Debug.WriteLine("Last");
        }