John Green
John Green

Reputation: 13

Make a line of code more elegant

I need to convert an unicode to letter and then paste the letter into a textbox. So I have a code like this:

textBox1.Text = Convert.ToString(Convert.ToChar(letter_code));

I think this code line doesn't look good and there's another way to do the same thing. Is it?

Upvotes: 0

Views: 120

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500365

Assuming letter_code is of type int, I'd probably cast to char and call ToString:

textBox1.Text = ((char) letter_code).ToString();

Upvotes: 1

Related Questions