Question Converting a function from C#

s1ckOh

Well-known member
Joined
Aug 1, 2011
Messages
68
Location
San Diego, Ca
Programming Experience
Beginner
I found a function I want to use in my project but when I used an online conversion tool I get an error.

C# Code...
VB.NET:
return (byte)('G' - 'A' + 10);

Conversion tool gave me this with the error, "Operator '-' is not defined for types 'Char' and 'Char'"
VB.NET:
Return CByte("G"c - "A"c + 10)

Here is what I got to work, it outputs "16"
VB.NET:
Return CByte(Asc("G"c) - Asc("A"c) + 10)

Question. Is the 3rd example equivelent to the C# code I want to use? Would it also output "16"?

Just trying to make sure I completely understand this before using it.
Thank you for any info.
 
Back
Top