Chuyển đổi tường minh yêu cầu toán tử ép kiểu (cast operator). Thực hiện bởi người dùng qua hàm định nghĩa sẵn.
Ví dụ: Ép double sang int
using System;
namespace Demo {
class Program {
static void Main(string[] args) {
double d = 345.78;
int i;
Console.WriteLine("double: " + d);
i = (int)d;
Console.WriteLine("int: " + i);
Console.ReadKey();
}
}
}
Kết quả: 345 (phần thập phân bị cắt bỏ).