Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

C# -> VB: Should be Sub instead of Function #743

Closed
LarHel opened this issue Jul 30, 2021 · 1 comment
Closed

C# -> VB: Should be Sub instead of Function #743

LarHel opened this issue Jul 30, 2021 · 1 comment
Labels
C# -> VB Specific to C# -> VB conversion

Comments

@LarHel
Copy link

LarHel commented Jul 30, 2021

Input code

list.ForEach(i => Console.Write("{0}\t", i));

Erroneous output

list.ForEach(Function(i) Console.Write("{0}" & vbTab, i))

Expected output

list.ForEach(Sub(i) Console.Write("{0}" & vbTab, i))

Details

@LarHel LarHel added the C# -> VB Specific to C# -> VB conversion label Jul 30, 2021
@GrahamTheCoder
Copy link
Member

Thanks for the report. This is caused by the converter (and indeed the VS compiler it uses) not being able to guess the type of "list", "ForEach" and "Console". For fragments like this, I've added a handful of common using statements that will handle this case and some other similar situations.

Please note that converter.telerik.com is a very old version of this converter library so I'd recommend using the latest version of it at https://codeconverter.icsharpcode.net/ (though this bugfix hasn't been released there just yet either)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C# -> VB Specific to C# -> VB conversion
Projects
None yet
Development

No branches or pull requests

2 participants