C# and VB.NET are the two most popular .NET languages that people use nowadays, and the need arises now and then that one has to be converted to another. Though there are some automatic converters here and there, online or offline, free or fee based, none can address real-world needs well enough even for some very small pieces of code, needless to say, big and commercial programs.
Here is such a small but very common case.
The original C# code:
public IEnumerable<int> Sample()
{
for (int i = 1; i <= 100; i++)
{
if (i % 7 == 0)
yield return i;
}
}
Tried several online free converters such as DeveloperFusion, Telerik, SharpDevelop, and CodeTranslator, but they all resulted in something not compiling at all like the following:
Public Function Sample() As IEnumerable(Of Integer)
For i As Integer = 1 To 100
If i Mod 7 = 0 Then
yield Return i
End If
Next
End Function
So, please double think it before making a suggestion of using some online free tools to convert real-world programs from C# to VB.NET or similar. If any readers have better, offline, or fee based converters, please help give the simple case a try and see what will happen there. Any feedback will be welcomed.