I am trying to write a method to scramble a message by adding 2 to the byte value of each character and then print the new message. This is what I got so far:
public static void MsgToCode(string value)
{
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(value);
foreach (var item in bytes)
{
byte b2= item;
b2 = (byte)(b2 + 2);
}
Console.ReadLine();
}
I tried using b2.ToString inside the foreach statement. But it doesn't work. What am I doing wrong?