Anonymous Methods don't Translate to VB

4 posts, 0 answers
  1. Anthony
    Anthony avatar
    1 posts
    Member since:
    Apr 2008

    Posted 11 Apr 2008 Link to this post

    I tried to convert some C# code with anonymous methods being passed as delegate parameters (ThreadPool.QueueUserWorkItem(WaitCallBack)) to VB.Net, but the VB code just left the parameter blank. I found another code converter that automatically defined named versions of the anonymous methods and used the "AddressOf" keyword followed by the name the methods were automatically given to properly translate the code.

    Keep in mind that I am not bashing your code converter, because I love it! I'm just saying I'd like to see support for converting anonymous methods from C# to its VB.Net equivalent. Thanks and keep up the good work with your UI controls!!
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 11 Apr 2008 Link to this post

    Anthony-

    Thanks for the feedback. This is actually an issue with the core conversion engine, which in the case of Code Converter is the open source NRefactor engine developed and maintained by the SharpDevelop guys. We try to rely on the open source community to fix problems with the core engine, so I'd highly encourage you to report your findings in the SharpDevelop forums over at http://community.sharpdevelop.net/forums/.

    As soon as the engine is patched, we'll be sure to upgrade the Code Converter!

    Hope that helps-
    Todd
  3. michel
    michel avatar
    1 posts
    Member since:
    Jun 2008

    Posted 09 Jun 2008 Link to this post

    None of the (equivalent) following syntaxes are converted.


    public void some()
    {
                    var myList = new List<int>();
      // test 1
                    // Boolean areAllPositive = myList.TrueForAll(value => value > 0);
      // test 2
      // Boolean areAllPositive = myList.TrueForAll((delegate(int i){return i>0;} ));
      // test 3
      Predicate<int> gt0 = x => x>0;
      Boolean areAllPositive = myList.TrueForAll(gt0);

    }

  4. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 10 Jun 2008 Link to this post

    Thanks for the report Michel. I'll take a look at the NRefactory community to see if any of these have been addressed and make sure we're using the latest version of the refactoring engine. Hopefully we can provide support for these conversions soon.

    Thanks-
    Todd
Back to Top