Click here to Skip to main content
14,878,230 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Respected People,
I have a problem in C#. How to convert a character to its ASCII/Unicode equivalent in c#?Thanks for the patient hearing and very sorry for the nuisance caused.

What I have tried:

I tried Convert.ToChar(). But unfortunately it is not working properly.
Posted
Updated 7-Aug-18 2:33am

1 solution

Quote:
How to convert a character to its ASCII/Unicode equivalent in c#?

A char type in C# is a Unicode character already - C# is all Uncode, with 16 bit wide characters.

If you mean an integer number to a char then just cast it:
C#
char a = (char) 97;
char A = (char) 65;
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900