In VB.Net, the usual way to declare a string would be :
Dim helloWorld As String = "Hello, World!"
However, you can also use dynamic variables, such as :
Dim helloWorld = "Hello, World!"
Both would end up to be the same thing, but what would be the best practice?
Really. VB sits on top of .Net, and .Net works best when you stick with explicit types. The only exceptions are with Option Infer
turned on (it is now by default) and you also declare variables similar to C#'s var
, or if you're doing COM interop or something else that truly requires a dynamic type... and that it is exceedingly rare.
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