public void Sample1() { var us1 = new UsingStatement1(); var us2 = new UsingStatement2(); us2.PrintMessage(); us1.PrintMessage(); }
public void OldSample() { using (var us1 = new UsingStatement1()) { using (var us2 = new UsingStatement2()) { us2.PrintMessage(); } us1.PrintMessage(); } }
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"); }