Problem with Substring, etc. (VB -> C#)

2 posts, 0 answers
  1. bdukes
    bdukes avatar
    14 posts
    Member since:
    Jun 2007

    Posted 03 Feb 2009 Link to this post

    Just ran into an issue with, where I had code calling Substring() and the converter started throwing errors about bad syntax.

    I was finally able to narrow it down to the following test case:
    a.Substring(0, 1)
    or just

    It looks like its choking on the "Sub" part of it, thinking that it's the keyword, not part of a function name.  If you lowercase the sub, as follows:
    a.substring(0, 1) 
    this works and translates fine (though, obviously it doesn't make valid C#).

    Just wanted to make sure this was documented.
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 04 Feb 2009 Link to this post

    Thanks for reporting the issue. We'll take a look at our wrapper for code conversion and make sure we're not causing this problem. We do some "magic" to help support the conversion of snippets (vs. full code files) and they may be at play here. I'll take a look and update this thread if the issue can be reproduced and then fixed.

Back to Top