I am coding in VB.NET.
Currently, I am enclosing object initialization and usage in a Try/Catch block and then tear it down (dispose, close, set to nothing) in the Finally block. The problem is, a C# 'using' block is so easy to use and would clean things up in my code.
Is there a VB.NET equivalent? Or is my Finally block tear-down solution the only way?
Though C# and VB.NET are syntactically very different, that is where the differences mostly end. Microsoft developed both of these languages to be part of the same . NET Framework development platform. They are both developed, managed, and supported by the same language development team at Microsoft.
Even the oldest coding languages such as Classic Asp, VB6, COBOL, FORTRAN, VB.Net, etc. are still in use in few organizations.
Visual Basic (VB.NET) will continue to be supported by Microsoft. (It's not dead.) The language will no longer have new features added to it.
A keyword is a reserved word with special meanings in the compiler, whose meaning cannot be changed. Therefore, these keywords cannot be used as an identifier in VB.NET programming such as class name, variable, function, module, etc.
It's the same, it's just:
Using conn As New SqlConnection .... End Using
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With