{
If (character. Length == 1)
{
System. Text.ascii encoding ascii encoding = new system. text . ascii encoding();
int intAsciiCode =(int)ascii encoding。 GetBytes(character)[0];
return(intAsciiCode);
}
other
{
Throws a new exception ("Invalid character." );
}
}
Call ASC () method to get ASC2 code, but the parameters passed must be letters. If it is a string, you should take each letter of the string one by one and put it in a permutation group, and then write a loop to call the ASC () method.