如何获得在C#中字符串的ASCII值

问题描述:

我想在C#中的字符串中的字符的ASCII值。

I want to get the ASCII value of characters in a string in C#.

如果我的字符串的值9quali52ty3,我想与每个11个字符的ASCII值的数组。

If my string has the value "9quali52ty3", I want an array with the ASCII values of each of the 11 characters.

我怎样才能获得的ASCII值在C#?

How can I get ASCII values in C#?

从的 MSDN

string value = "9quali52ty3";

// Convert the string into a byte[].
byte[] asciiBytes = Encoding.ASCII.GetBytes(value);

您现在有个字节的ASCII值的数组。我得到了以下内容:

You now have an array of the ASCII value of the bytes. I got the following:

57
113
117
97
108
105
53
50
116
121
51

57 113 117 97 108 105 53 50 116 121 51