Results 1 to 18 of 18

Thread: Yet more trouble...

Threaded View

  1. #13
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Yet more trouble...

    Quote 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.
    Quote 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.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width