Implicit type cast of char to int in C#

c#

Solution

Casting will cause data loss. Here char is 16 bit and int is 32 bit. So the cast will happen without loss of data.

Real life example: we can put a small vessel into a big vessel but not vice versa without external help.

Problem

I have a question about the implicit type conversion Why does this implicit type conversion work in C#? I've learned that implicit code usually don't work. I have a code sample here about implicit type conversion ``` char c = 'a'; int x = c; int n = 5; int answer = n * c; Console.WriteLine(answer); ```

Original source