Để chuyển đổi hoàn toàn char thành Thập phân, trước tiên hãy đặt một ký tự.
char c = 'p';
Để chuyển đổi ký tự thành số thập phân, hãy chỉ định giá trị.
decimal dec; dec = c;
Hãy để chúng tôi xem ví dụ trên.
Ví dụ
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);
}
} Đầu ra
Implicit conversion from Char to Decimal Decimal : 112