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

Anonymous Methods don't Translate to VB

3 Answers 39 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.
Anthony
Top achievements
Rank 1
Anthony asked on 11 Apr 2008, 02:10 PM
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!!

3 Answers, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 11 Apr 2008, 08:17 PM
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
0
michel
Top achievements
Rank 1
answered on 09 Jun 2008, 03:50 PM

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);

}

0
Todd Anglin
Top achievements
Rank 2
answered on 11 Jun 2008, 12:03 AM
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
Tags
Code Converter
Asked by
Anthony
Top achievements
Rank 1
Answers by
Todd Anglin
Top achievements
Rank 2
michel
Top achievements
Rank 1
Share this question
or