Calling Dispose() vs when an object goes out scope/method finishes
问题 I have a method, which has a try/catch/finaly block inside. Within the try block, I declare SqlDataReader as follows: SqlDataReader aReader = null; aReader = aCommand.ExecuteReader(); In the finally block, the objects which are manually disposed of are those which are set at the class level. So objects in the method which implement IDisposable , such as SqlDataReader above, do they get automatically disposed of? Close() is called on aReader after a while loop executes to get the contents of