using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _2字符串 { class Program { static void Main(string[] args) { //string s = "\"ab\""; //string s = "a\nb"; //n:newline //string s = "a\\b"; //string s = "c:\temp\\fasdf\\dd\aa\\1.jpg"; //string s = "\\\\"; //string s = @"\\\\"; //字符串中的字符不当成转义符 string s = @"c:\temp\fasdf\dd\aa\1.jpg"; //string s = @""ab""; //错误,@只对转义符有意义 Console.WriteLine(s);
//转义符只针对在代码中直接写出的字符串,对于程序中直接读出来字符串没有这个问题 Console.ReadKey(); } } }