Does “using” also dispose objects created in the constructor? [duplicate]
问题 This question already has answers here : Nesting 'IDisposable's in a single 'using' statement (3 answers) Closed 4 years ago . When creating an element that implements IDisposable , Dispose() is called at the end of the using block also if an exception is thrown, if I'm correct. However, when creating a new element of ClassB within the constructor of a disposable element, will the object of ClassB also be disposed if IDisposable is implemented? using (ClassA a = new ClassA(new ClassB())) { }