Creating objects via New

  • Thread starter Thread starter tinman
  • Start date Start date
T

tinman

Hi...

Are there performance issues related to the way in which the New keyword is
used
in VB.NET?

For example, is there a difference betwen the following calls:

1. Dim TestString as StringBuilder = New Stringbuilder

2. Dim TestString as New StringBuilder

Thanks...
 
I don't believe so. Either method will create the new object. It's just a
matter of preference. I like the second method because it requires less
code.
 
* "tinman said:
Are there performance issues related to the way in which the New keyword is
used
in VB.NET?

For example, is there a difference betwen the following calls:

1. Dim TestString as StringBuilder = New Stringbuilder

2. Dim TestString as New StringBuilder

Maybe only at compile time, but not at runtime :-).
 
Back
Top