|
-
Sep 2nd, 2008, 10:00 AM
#13
Re: Yet more trouble...
 Originally Posted by techgnome
It's precisely that kind of thinking that gets people into trouble when they do this:
Code:
Dim a as Integer = 5
Dim b as Integer =6
text1.text = A + B
And then wonder why they got 11 instead of 56.
With Option Strict that would fail since they're not strings... I would like to think that if someone has Option Strict on and run into that, that they will figure out the problem and receive a better understanding of how assignment works but that's not to say that'll happen or that & is not a better alternative.
 Originally Posted by jmcilhinney
If you're using the string concatenation operator then what other type would your result be but a string? If you don't want a string result then why would you be concatenating in the first place?
I'm not saying I would expect a different result but I would prefer the code explicitly state a conversion is taking place.
I just always try to avoid implicit conversions as they can cause code confusion to those not as familiar and it may not always work the way you expect it to work with custom classes (can you overload the & operator?).
Last edited by Kasracer; Sep 2nd, 2008 at 10:04 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|