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

Error in coversion

1 Answer 49 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.
atul
Top achievements
Rank 1
atul asked on 02 Dec 2011, 01:31 AM
converter from vb.net to c# problem

ToString in vb get converts to ToString.....though it should be ToString()

For Example
vb.net
WSConnectionString = Security.Decrypt(notnothingStringXml(n).ToString)
converts to
WSConnectionString = Security.Decrypt(notnothingStringXml(n).ToString);
though it should be
WSConnectionString = Security.Decrypt(notnothingStringXml(n).ToString());


other bizzare thing is
vb.net
Dim rndChr As Integer = (buffer1(i) Mod 87)
converts to
int rndChr = (buffer1(i) % 87);
though it should be
int rndChr = (buffer1[i] % 87);

1 Answer, 1 is accepted

Sort by
0
Todd
Telerik team
answered on 04 Jan 2012, 06:14 PM
Hello atul,

Sorry for the trouble with your conversions. As it happens, there are a few cases where the open source NRefactory engine doesn't well handle the VB to C# conversion. One of those cases is trying to add "()" to C# when they're missing in VB. Technically, VB could also have the "()", so it's hard for the converter to predicatively add these characters. 

The other challenge the syntax converter has is converting parenthesis to brackets. I think it's because the conversion engine doesn't fully understand your code (since it's not trying to compile it), so it doesn't know if the parens in VB are method calls or indexers. In VB parens can be both; in C#, parens are only for methods, and brackets are only for indexers.

We'll investigate possible solutions to both issues, though. For now, expect to make some manual tweaks if your VB code covers either of these cases.

-Todd

Tags
Code Converter
Asked by
atul
Top achievements
Rank 1
Answers by
Todd
Telerik team
Share this question
or