How do I convert from unicode to single byte in C#?

Posted by xarzu on Stack Overflow See other posts from Stack Overflow or by xarzu
Published on 2010-04-12T20:17:17Z Indexed on 2010/04/12 20:22 UTC
Read the original article Hit count: 361

Filed under:
|
|

How do I convert from unicode to single byte in C#?

This does not work:

int level =1;
string argument;
// and then argument is assigned

if (argument[2] == Convert.ToChar(level))
{
    // does not work
}

And this:

char test1 = argument[2];
char test2 = Convert.ToChar(level);

produces funky results. test1 can be: 49 '1' while test2 will be 1 ''

© Stack Overflow or respective owner

Related posts about c#

Related posts about char