Welcome to our official feedback forum for the code converter. If you spot problems with the converter, just leave a note here. **Please make sure you include a code sample***
-
3 votes
BitWise operations
public bool IsInRole(Role role) {
Role userRole = (Role)this.Role;
return ((userRole & role) == role);
}[Flags]
public enum Role {
Student = 1, // 0001
Employer = 2, // 0010
Staff = 4, // 0100
Admin = 8 // 1000
} -
1 vote
Comparing potentially null variables
string x = null;
if(string.Empty == x)
{
System.Console.WriteLine("Shouldn't get here");
}On conversion, the if statement uses = (If String.Empty = x) which will evaluate to true when x is nothing, but will not evaluate to true when x is null in C#.
-
1 vote
problem with unary minus
digit = int.Parse(number.Substring(i-1, 1));
//ha em, your parser has a bug in unary expressions
i switched the expression with (i+(–1))
now it works -
3 votes
C# to Python huge error.
From
public partial class AllDepViewFieldCollection : RowDataAdapterCollection<AllDepViewField> converts to
class AllDepViewFieldCollection(RowDataAdapterCollection).Where is generic type parameter?!!
-
1 vote
Convert to VB.net
<script language="javascript">
function openPopup(strOpen)
{
open(strOpen, "Info",
"status=1, width=300, height=200, top=100, left=300");
}
</script>This won't convert to vb.net
-
1 vote
Function declaration doesn't convert
The following returns an error:
"-- line 1 col 1: EOF expected" - Why would an EOF be expected at the beginning of the code to be translated??? Here is the code:
Function xmlAddElement(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs, ByVal strID As String, ByVal strErrType As String) As… moreHey - try adding an End Function to the code - that should do the trick.
-
1 vote
return objDataAccess.GetDataSet.Tables(0);
return objDataAccess.GetDataSet.Tables(0);
-
3 votes
i++; fails
When converting the following from C# to VB.NET it fails to convert correctly.
int i=5;
int j=i++;
//i=6 and j=5
It sets Dim j = System.Math.Max(System.Threading.Interlocked.Increment(i),i-1)Not possible for i-1 to be greater than i+1
-
1 vote
when converting string functions to vb it suggests to use string.* wich do not exists
When converting the followong vb code to c# it suggests to use strings.mid() function in c# wich appears not to exists.
Private Sub stringmid(ByVal str As String)
Dim mystr As String
mystr = Mid(str, 2)
End Subconverts to
private void stringmid(string str)
{
string mystr = null;
mystr =… more -
1 vote
Implementing an Interface
C# code to implement an interface:
using System.ServiceModel;
[CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
internal class Callback : MyInterfaceDid not convert properly to VB.NET. The conversion had "Inherits MyInterface". It should've had "Implements MyInterface"
-
3 votes
Convert this to vb
CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
{
configSetter(ConfigurationManager.AppSettings[configName]);
}); -
3 votes
when converting from VB to C# translate AND to && - important bug that woul dbe very hard to pick up
AND in VB translates to && in C# in most if exoressions
-
1 vote
I have a problem converting this code:
public static readonly DependencyProperty ProgressProperty = DependencyProperty.RegisterAttached("Progress", typeof(double), typeof(ViewportAnimation), new PropertyMetadata(0.0, new PropertyChangedCallback(delegate(DependencyObject o, DependencyPropertyChangedEventArgs e) { ((ViewportAnimation)o).ProgressChanged(e); }))); VB.Net Converter gives me this:
Public Shared ReadOnly ProgressProperty As DependencyProperty = DependencyProperty.RegisterAttached("Progress", GetType(Double), GetType(ViewportAnimation), New PropertyMetadata(0.0, New PropertyChangedCallback(Function(o As DependencyObject, e As DependencyPropertyChangedEventArgs) Do
DirectCast(o, ViewportAnimation).ProgressChanged(e)
End Function)))There seems… more
-
2 votes
Dim b(b1.Length + b2.Length - 3) As Byte
VB
Dim b(b1.Length + b2.Length - 3) As ByteConverted C#
byte[] b = new byte[b1.Length + b2.Length - 2];Why is it changing my math?
I've been using this converter to teach myself C#. Great tool. -
1 vote
LINQ VB.Net -> C# (where clause)
In this case, the converter doesn't work
p.s. this syntaxe is valid in VB.NetFrom a In ListOfA
Select a
Where a Is AIf we change the Where clause position, just like we do in C# in fact, it works :
From a In ListOfA
Where a Is A … more -
1 vote
CS -> VB lamba quirk
C# implementation:
Array.ForEach(
Enum.GetNames(typeof(LightStyle)),
s => m_lightstyle.Items.Add(new ListItem(s))
);Due to VB inline functions requiring a return value, here is probably a better interpretation.
VB Implementation:
For Each s As String In [Enum].GetNames(GetType(LightStyle))
Me._lightStyle.Items.Add(New ListItem(s))
Next -
1 vote
Cannont convert Nullable property using ?
When trying to convert from VB.Net to C# (or vice versa), if you have a nullable property that is created using the ? and not Nullable<> the post back on your page is not ready correctly.
Public Property CurrentDate As DateTime?
I should be able to pass that and get
… more
-
1 vote
Pointers don't get converted properly
This line of code:
int* a = &b;
gets converted into this:
Dim a As Pointer(Of Integer) = AddressOfb
As you can see, there is a space missing between AddressOf and b.
-
1 vote
intptr == int after conversion from vb.net
It's not possible in c# to confront an int pointer with an integer type
