字符串转义字符

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleProgamming
{
    class Program
    {
        static void Main(string[] args)
        {
            //string s = ""ab"";     "ab"
            //string s = "a b"; //n:newline     a
                                                             //b
            //string s = "a\b";     a
            //string s = "c: emp\fasdf\ddaa\1.jpg";   c:      empfasdfdda1.jpg
            //string s = "\\";    \
           // string s = @"\\"; //字符串中的字符不当成转义符      \\
            //string s = @"c: empfasdfddaa1.jpg";          c: empfasdfddaa1.jpg
           // string s = @""ab""; //错误,@只对转义符有意义
            Console.WriteLine(s);

            //转义符只针对在代码中直接写出的字符串,对于程序中直接读出来字符串没有这个问题

            Console.ReadKey();
        }
    }
}

原文地址:https://www.cnblogs.com/lcyuhe/p/3747724.html