C#中的charCodeAt()等价物是什么?

use*_*064 3 javascript c# asp.net c#-4.0

C#中的charCodeAt()等价物是什么?

现行代码:

   string outString="";
    for (var i = 0; i < inpString.Length; i++)
    {
    outString += inpString.charCodeAt(i).toString(); //i need to replaced charCodeAt(i) with equalent c# code
    }
Run Code Online (Sandbox Code Playgroud)

我怎样才能在C#中做到这一点?

Kai*_*las 6

试试这个

string outString="";

for (var i = 0; i < inpString.Length; i++)

{

outString+= ((int)inpString[i]).ToString();

}
Run Code Online (Sandbox Code Playgroud)