This post will discuss how to convert an int to a char in C#.

1. Explicit conversion (casts)

C# doesn’t support implicit conversion from type ‘int’ to ‘char’ since the conversion is type-unsafe and risks potential data loss. However, we can do an explicit conversion using the cast operator (). A cast informs the compiler that the conversion is intentional.

The following program casts the value of an integer to a Char value.

Download  Run Code

2. Using Convert.ToChar() method

We can use the Convert.ToChar() method to convert an integer to its equivalent Unicode character. The following example converts the value of an integer to a char value. The program throws an OverflowException if it is outside the range of the char data type (0-65535).

Download  Run Code

3. Using Char.ConvertFromUtf32() method

We can use the Char.ConvertFromUtf32() method to convert the specified Unicode code point into a UTF-16 encoded string.

Download  Run Code

That’s all about converting int to a char in C#.