Kenny Chan Kenny Chan - 11 days ago 4x Question

VB to c# code conversion error?

[VB codes]

enter image description here

[C# codes]

enter image description here

I have made a conversion from VB to C# with telerik online converter. And there is an error with the "Conversion" method in the c# code as it isnt a method that exists. What should be the correct syntax to fix to code in c#?

I do not understand the syntax used in VB.


Int is a VB6 functuion that you should avoid in VB.NET too.

Use int.Parse or int.TryParse if you have a string and System.Convert.ToInt32 if you have an object:

int i = Convert.ToInt32(sn);

Int this case you could simply use the cast operator since enum values must be intor long:

int i = (int)sn;