Page 2 of 2 FirstFirst 12
Results 41 to 45 of 45

Thread: [RESOLVED]implicit conversion from integer to string

  1. #41
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: implicit conversion from integer to string

    Quote Originally Posted by jokerfool View Post
    Yes after reading this page earlier

    http://msdn.microsoft.com/en-us/libr...=vs.71%29.aspx
    I didn't actually ask whether you knew what implicit and explicit conversions are. I asked whether you knew what the words "implicit" and "explicit" mean. They are not specifically programming terms and, as apparently a native English speaker, you should know what they mean already. If you know how to imply something, i.e. suggest something without actually saying it outright, then you know what implicit means. If you know what implicit means then you inherently know what explicit means. If you do something and I say that only a stupid person would do that, I'm obviously saying that you're stupid but I never actually said that you're stupid. The fact that you're stupid is implicit in my statement. If I just came out and called you stupid then my statement would be explicit. By the way, I don't actually think you're stupid. That was just an example that came to mind.

    Now, in your code, you are assigning an Integer value to a String property. A String property can only hold a String so you are implying that the value must be converted without actually converting it. That's an implicit conversion. If you convert the value yourself then that's an explicit conversion.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  2. #42
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Re: implicit conversion from integer to string

    I completely agree it's no different. How ever i was more encouraging the op to show me evidence he was using an integer as a setting rather then have us guess. Then we could of suggest a more valid handling using integer.parse etc.

  3. #43
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: implicit conversion from integer to string

    The OP has obviously inherited the code so he might not know where and how this function is used elsewhere. By just looking at the naming convention used by this method one must assume that it was intended for this function to return an integer and most likely for good reasons.

  4. #44
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Re: implicit conversion from integer to string

    Quote Originally Posted by Joacim Andersson View Post
    The OP has obviously inherited the code so he might not know where and how this function is used elsewhere. By just looking at the naming convention used by this method one must assume that it was intended for this function to return an integer and most likely for good reasons.
    For such a basic question should we just assume the OP knows any thing about naming conventions? I simply decided not to assume the op understand whats being returned since his/hers question referenced implicit conversion.

  5. #45
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: implicit conversion from integer to string

    But the code is inherited, the OP did not write the project or this method. Why do you assume that the intended code should look different? The question that was asked was answered already in post #3 (or was it #4). I don't understand why this pretty simple and straight forward question has caused this thread to become 45 posts in length.

Page 2 of 2 FirstFirst 12

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