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

VB to CS conversion issue

1 Answer 117 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.
lchesnais
Top achievements
Rank 1
lchesnais asked on 11 Apr 2007, 10:29 PM
Hello,

I tried the converter with a Telerik code sample in VB (DragDropGridRows).
I ran into a small issue: The following translation is invalid in CS 
VB: If Not eventArgument Is Nothing Then
CS: if (!eventArgument == null)
Should be : if (eventArgument != null)

I hope this feedback will help you. Your tool is great! Thanks.

BR, Laurent

1 Answer, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 12 Apr 2007, 12:54 PM
Laurent,

Thanks for the feedback. That is an interesting scenario and definitely feedback for the SharpDevelop community that maintain and enhances the NRefactory engine.

The challenge for NRefactory is probably that the converted C# syntax is not necessarily wrong. It all depends on the eventArgument type. If "eventArgument" were a boolean value type, the syntax would compile. This is just one of those ambiguous cases where the converter is probably left to guess what "eventArgument" is and it defaults to the syntax that most closely represent the original syntax.

You can help the converter be altering your VB like this:
If Not (eventArgument Is Nothing) Then
Which produces C# like this:
if (!(eventArgument == null))
Which is more likely to be valid.

In any event, good observation. Check out the SharpDevelop forums/bug reports for a more direct link to the people involved with maintaining the engine:

http://community.sharpdevelop.net/forums/

Thanks~
Todd
Tags
Code Converter
Asked by
lchesnais
Top achievements
Rank 1
Answers by
Todd Anglin
Top achievements
Rank 2
Share this question
or