Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VB.Net Question
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Divers
Thread ID:
01399325
Message ID:
01399329
Vues:
62
>What is the difference between these two lines of code?
>
>
>Dim MyConnection As New SqlConnection()
>Dim RetVal As SqlConnection = New SqlConnection()
>
Additionnally to what Mike said, I like the second declaration as it shows the type and the value/object assigned to it.

But, sometimes, we cannot do that. What I do in this case, is to assign to Nothing. Then, in the code later down below, I can assign the value or the object to it. I always have all my declarations at the top with a pre-defined value assigned to it. This makes it more clear to read and understand its meaning.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform