System.Math.Max(System.Threading.Interlocked.Increment(k),k - 1)

5 posts, 0 answers
  1. Mikhail Grushin
    Mikhail Grushin avatar
    2 posts
    Member since:
    Dec 2005

    Posted 18 Apr 2007 Link to this post

    C#
    int k = 0;
    int a = k++;

    VB#
    Dim k As Integer = 0
    Dim a As Integer = System.Math.Max(System.Threading.Interlocked.Increment(k),k - 1)
  2. Mike
    Mike avatar
    524 posts
    Member since:
    Feb 2007

    Posted 18 Apr 2007 Link to this post

    According to this forum thread:

    http://www.telerik.com/community/forums/thread/b311D-ttbhd.aspx

    This is a problem in the NRefectory engine, hopefully it will be addressed soon.
  3. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 19 Apr 2007 Link to this post

    Mikhail-

    Mike is correct. Issues with the way the converter actually converts code are related to the inner workings of NRefactory. The best way to get that core engine improved is to post your comments on the SharpDevelop forums (the people that maintain NRefactory) at www.sharpdevelop.net.

    Unfortunately, we don't have the time or resources to fully understand and enhance the NRefactory engine at this time. Any improvements SharpDevelop makes, though, we'll quickly add to the site!

    Thanks~
    Todd
  4. Mark Fenn
    Mark Fenn avatar
    1 posts
    Member since:
    Jan 2004

    Posted 30 Jul 2008 Link to this post

    I found this as well, a simple VB loop

    For x as integer = 1 To 100
        dim a as integer
        a = x
    Next

    Translates to C# fine:

    for (int x = 1; x <= 100; x++) {
        int a;
        a = x;
    }

    but if you try to go from C# to VB this mess shows up:

    Dim x As Integer = 1
    While x <= 100
        Dim a As Integer
        a = x
        System.Math.Max(System.Threading.Interlocked.Increment(x),x - 1)
    End While
  5. Bruno
    Bruno avatar
    105 posts
    Member since:
    Mar 2008

    Posted 30 Jul 2008 Link to this post

    Todd explain the situation pretty well. I personally use several translators, not just one. You can use CarlosAg CodeTranslator for example. Otherwise you can post your comments on the SharpDevelop forums as already suggested.
Back to Top