Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VB.NET question I
Message
 
 
To
15/09/2009 11:06:06
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
01424535
Message ID:
01424537
Views:
60
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform