P
Peter Merwood
Hi
I've been coding in VB for a good number of years and have recently made the
switch to VB.NET. When coding I put all my declaration/Dim statements at
the beginning of the Sub or Function before any "real" code. VB.NET lets
you scatter declaration statements throughout a Sub or Function and it seems
even have conditional declaration statements, ie;
If x = "something" then
dim y as Integer
dim z as Integer
<some code>
End if
Are there any performance advantages/disadvantages to be gained/lost by only
declaring variables immediately before you're going to use them as shown in
the above example? I've looked through the MSDN and .NET documentation for
any performance tips like this. Can someone point me to a good resource
that discusses these types of issues?
Thanks.
Peter
I've been coding in VB for a good number of years and have recently made the
switch to VB.NET. When coding I put all my declaration/Dim statements at
the beginning of the Sub or Function before any "real" code. VB.NET lets
you scatter declaration statements throughout a Sub or Function and it seems
even have conditional declaration statements, ie;
If x = "something" then
dim y as Integer
dim z as Integer
<some code>
End if
Are there any performance advantages/disadvantages to be gained/lost by only
declaring variables immediately before you're going to use them as shown in
the above example? I've looked through the MSDN and .NET documentation for
any performance tips like this. Can someone point me to a good resource
that discusses these types of issues?
Thanks.
Peter