VB to CS conversion issue

2 posts, 0 answers
  1. lchesnais
    lchesnais avatar
    39 posts
    Member since:
    Feb 2007

    Posted 11 Apr 2007 Link to this post


    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
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 12 Apr 2007 Link to this post


    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:


Back to Top