Implicit conversion from Char to Decimal in C#


To implicitly convert char to a Decimal, firstly set a char.

char c = 'p';

To convert char to decimal, assign the value.

decimal dec;
dec = c;

Let us see the above example.

Example

 Live Demo

using System;
public class Demo {
   public static void Main() {
      char c = 'p';
      decimal dec;
      Console.WriteLine("Implicit conversion from Char to Decimal");
      dec = c;
      Console.WriteLine("Decimal : "+dec);
   }
}

Output

Implicit conversion from Char to Decimal
Decimal : 112

Updated on: 23-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements