Look at this Code:
string s = "0x00A5";
Console.WriteLine(((char)s).ToString()); //Error
Console.WriteLine(((char)0x00A5).ToString());
I know why there is an error but i have no Idea how to solve this.
Any suggestions?
Edit:
string stringHex = "7A";
int intFromHex = int.Parse(stringHex , System.Globalization.NumberStyles.HexNumber) + 30;
string hex = intFromHex.ToString("X");
switch(hex.Length)
{
case 2:
hex = "0x00" + hex;
break;
case 3:
hex = "0x0" + hex;
break;
case 4:
hex = "0x" + hex;
break;
}
char c = (char)hex;
string s = "0x00A5";
Console.WriteLine(((char)s).ToString());
Console.WriteLine(((char)0x00A5).ToString());
This is the whole Code. Im trying to generate a string with random unicode Chars.