Character Constants (Hằng ký tự)
Character literal trong single quotes: 'x'. Lưu trong biến char. Có thể là plain char ('x'), escape sequence ('\t'), universal char ('\u02C0').
Ký tự đặc biệt có backslash: newline \n, tab \t.
Ví dụ
using System;
namespace Demo {
class MyApplication {
static void Main(string[] args) {
Console.WriteLine("Welcome\t to the website\n\n");
Console.ReadLine();
}
}
}
Kết quả
Welcome to the website
String Literals (Hằng chuỗi)
String literal trong double quotes "" hoặc @"". Chứa ký tự tương tự character literal: plain, escape, universal.