If I return a value inside a using block in a method, does the using dispose of the object before the return?
问题 I'm going through some old C#.NET code in an ASP.NET application making sure that all SqlConnections are wrapped in using blocks. I know that using is the same as try / finally where it disposes of the object in the finally no matter what happens in the try . If I have a method that returns a value inside the using , even though execution leaves the method when it returns, does it still call .Dispose() on my object before/during/after it's returning? public static SqlCommand getSqlCommand