This is a migrated thread and some comments may be shown as answers.

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

4 Answers 288 Views
Code Converter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mikhail Grushin
Top achievements
Rank 1
Mikhail Grushin asked on 18 Apr 2007, 05:57 PM
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)

4 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 18 Apr 2007, 06:13 PM
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.
0
Todd Anglin
Top achievements
Rank 2
answered on 19 Apr 2007, 11:26 PM
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
0
Mark Fenn
Top achievements
Rank 1
answered on 30 Jul 2008, 04:24 PM
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
0
Bruno
Top achievements
Rank 2
answered on 30 Jul 2008, 04:43 PM
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.
Tags
Code Converter
Asked by
Mikhail Grushin
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Todd Anglin
Top achievements
Rank 2
Mark Fenn
Top achievements
Rank 1
Bruno
Top achievements
Rank 2
Share this question
or