cqujsjcyj 发表于 2013-2-4 22:26:18

C#--字符串 @符号的作用

C#--字符串 @符号的作用
@符号:表示字符串里面是什么就是什么;
 
 
           static void Main(string[] args)
        {
            string str1,str2;
            str1 = "C:\\windows\\cyj";  //--两个斜杠表示转义字符,即得到单斜杠;
            str2 = @"C:\\windows\cyj";  //--@符号,表示字符串里面是什么就是什么;
 
            Console.WriteLine(str1);  //--输出:C:\windows\cyj
            Console.WriteLine(str2);  //--C:\\windows\cyj

            Console.ReadLine();
        }
 
页: [1]
查看完整版本: C#--字符串 @符号的作用