Chuẩn "C" (Currency) định dạng số thành chuỗi tiền tệ theo culture hiện tại (ký hiệu tiền tệ, phân nhóm nghìn, phần thập phân).
Ví dụ minh họa
using System;
using System.Globalization;
class Demo
{
static void Main()
{
double value = 234.66;
Console.WriteLine(value.ToString("C", CultureInfo.CurrentCulture));
Console.WriteLine(value.ToString("C3", CultureInfo.CurrentCulture));
}
}
Kết quả đầu ra
$234.66 $234.660
Tham số độ chính xác: C (mặc định 2 chữ số thập phân theo culture), C0, C1, C3, C5...
Culture quan trọng: CultureInfo.CurrentCulture (hệ thống), CultureInfo.InvariantCulture (chuẩn quốc tế), hoặc culture cụ thể new CultureInfo("vi-VN") cho VNĐ (đ, phân nhóm chấm).