BUZZZZZZZZ! nope!
A VB.NET With block only allows the developer to not specify the object
name when calling properties, methods etc. As in:
With myObj
.DoSomething()
.DoSomethingElse
aString = .ToString()
End With
The using statement, as representedin my example, means the compiler
will automatically call Dispose() when the assigned instance goes out
of scope.
So, the object assigned in the using statement must implement interface
IDispose.
For the C# folks, I realize the using statement is a C# construct;
however, I am just trying to find if there is an equivelent construct
in VB.NET.
Oenone wrote:
Does VB.NET have an equivelent of the following C# statement (the
using part):
using (SqlConnection connection = new SqlConnection(connStr))
{
}
I believe this would translate as:
Dim connection As New SqlConnection(connStr)
With connection
[...]
End With
Hope that helps,