Hi @tim , Welcome to Microsoft Q&A,
In C#, the Asc
function from VB can be replaced with Convert.ToInt32(char)
when working with characters, as Asc
returns the ASCII (or Unicode) value of a character.
VB Code:
Newstr = Newstr & Chr(Asc(Mid(str,x,1)) - Asc(Mid(key,KeyPos,1)))
C# Conversion:
Newstr += Convert.ToChar((int)reverseString.Substring(x, 1)[0] - (int)key.Substring(KeyPos, 1)[0]);
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.