Why is a string printed as a unicode character rather than readable text in C#? -
i have string create get; set;:
public static string userdirinput { get; set; }
i use console.read();
give value:
userdirinput = convert.tostring(console.read());
and before go compare print out :
console.write("read " + (string)userdirinput);
its printing out unicode values , not readable text...
what do print out readable text?
you want use console.readline
, returns string
. console.read
reads single character, , returns int32
. if cast char
, you'd see reading first letter user typed, not entire string.
Comments
Post a Comment