I don’t know how to encode each character of a string in a loop into an ASCII number of an element. There is a str - the string english \ russian letters.
It works
byte[] bytes = Encoding.GetEncoding(1251).GetBytes(str); And this is not - he writes, str[i] underlines that the char cannot be converted to char []. Maybe this is due to the fact that in the first case the array, but not here.
Encoding.GetEncoding(1251).GetBytes(str[i]) I would have the representation of a number in int in order to calculate the character position in the alphabet through it
str[i]is not a string, but a character - VladDbyte[] bytes = Encoding.GetEncoding(1251).GetBytes(str); for (int i = 0; i < bytes.Length; i++) Console.WriteLine(bytes[i]);byte[] bytes = Encoding.GetEncoding(1251).GetBytes(str); for (int i = 0; i < bytes.Length; i++) Console.WriteLine(bytes[i]);gives codes for Russian characters? - ImmRaytal