Administrator
VB.NET Forum Admin
- Joined
- Jun 3, 2004
- Messages
- 1,462
- Programming Experience
- 10+
If I have code such as:
Is there any impact in "returning" out of a Using..End Using block? In other words, is the connection automatically closed and disposed if I return out of the block (back to the function)? I'm curious if it ever gets to End Using if you return from within the block. The alternative of course is to use the old code method of GetAnswer=Value and then it will return the result that way.
VB.NET:
Public Function GetAnswer() as String
Using Connection As New SQLConnection(...)
...some code here
Return TheAnswer
End Using
End Function
Is there any impact in "returning" out of a Using..End Using block? In other words, is the connection automatically closed and disposed if I return out of the block (back to the function)? I'm curious if it ever gets to End Using if you return from within the block. The alternative of course is to use the old code method of GetAnswer=Value and then it will return the result that way.