Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VB.NET question I
Message
 
 
À
15/09/2009 11:06:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
01424535
Message ID:
01424537
Vues:
61
>Hello, I have a (begginner) question on VB.NET.
>
>Is this good code (I mean, is it "bullet proof")?. It seems to work, but I understand the Return is executed AFTER the Finally. So how does it call a method on an allready disposed of object?
>
>
>
>public function myFunc(...) as string
>   Dim sStr As New System.Text.StringBuilder("")
>
>   Try
>   ... some code here ...
>   Return sStr.ToString
>
>   Catch ex As Exception
>   ... some code here ...
>   
>   Finally
>       sStr = Nothing
>   End Try
>
> End Function
>
>
Doesn't look correct to me. I would keep the return statement as the last one in this procedure.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform