Selecting Proper Variables

S

SStory

Well that's nice.

I know it wasn't that way in prior version of vb, and for that reason Hard
Core VB mentioned using one globally defined empty instance.

Thanks,

Shane
 
D

David

That's why there will be a 'TryParse' method for the 'Int32' datatype in
.NET 2.0.

In addition, TryParse has the correct semantics, as opposed to the VB
Is??? functions. TryParse (at least last time I saw it) doesn't just
test, it also performs the conversion, so we can avoid code that looks
like...

If ParseThisOnceJustToTest(myvar) Then
anotherVar = ParseThisAgainJustToWasteTime(myvar)
End If
 
J

Jay B. Harlow [MVP - Outlook]

Shane,
Correct VB6 & prior did not intern string literals.

I should add, that the string interning is true for all string literals.

There is only one instance of the "aaa" string in the following:

Dim s1 As String = "aaa"
Dim s2 As String = "aaa"

Hence the "New String("a"c, 3)" in my example, I was creating a string with
3 a's that was not a literal.

Hope this helps
Jay


SStory said:
Well that's nice.

I know it wasn't that way in prior version of vb, and for that reason Hard
Core VB mentioned using one globally defined empty instance.

Thanks,

Shane
<<snip>>
 
Top