Initialize char with int

  • Thread starter Thread starter msnews.microsoft.com
  • Start date Start date
M

msnews.microsoft.com

Hi!

In C++ you could easily intialize a char-variable with an integer value:
char ch = 123;

How can we accomplish this in C#?
You can get the integer representation of a char value easily, but what
about the opposite?

TIA,

Markus
 
msnews.microsoft.com said:
In C++ you could easily intialize a char-variable with an integer value:
char ch = 123;

How can we accomplish this in C#?

char ch = (char)123;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top