本帖最后由 wujingyi2011 于 2012-11-11 16:57:56 编辑

解决方案 »

  1.   

    在这里是禁止转义字符转义,使转义字符原样输出。还可以屏蔽关键字。
    比如object @boject = "aaaaaa";
      

  2.   

    同意楼上,例如 var email= @"http:\\testest.com"
      

  3.   

    string a = "hello, world"; // hello, world
    string b = @"hello, world"; // hello, world
    string c = "hello \t world"; // hello   world
    string d = @"hello \t world"; // hello \t world
    string e = "Joe said \"Hello\" to me"; // Joe said "Hello" to me
    string f = @"Joe said ""Hello"" to me"; // Joe said "Hello" to me
    string g = "\\\\server\\share\\file.txt"; // \\server\share\file.txt
    string h = @"\\server\share\file.txt"; // \\server\share\file.txt
    string i = "one\r\ntwo\r\nthree";
    string j = @"one
    two
    three";
      

  4.   

    C# 支持两种形式的字符串:常规字符串 (regular string literal) 和原义字符串 (verbatim string literal)。
    正则字符串由包含在双引号中的零个或多个字符组成(如 "hello"),并且可以包含简单转义序列(如表示制表符的 \t)、十六进制转义序列和 Unicode 转义序列。
    原义字符串由 @ 字符后跟开始的双引号字符、零个或多个字符以及结束的双引号字符组成。一个简单的示例就是 @"hello"。在原义字符串中,分隔符之间的字符逐字解释,唯一的例外是 quote-escape-sequence(引号转义序列)
      

  5.   

    在C#语言中,@有两个作用,一个上面说了,忽略字符串中的转义字符,另一个是,用来避免和关键字冲突,比如你需要定义一个类,里面偏偏需要一个叫if的成员,可是if是C#关键字,那么你可以这么写
    class Foo
    {
        public int @if = 0;
    }
      

  6.   

    但是在.net mvc 中 在页面@ 的意思是可以输入后台的代码。如@(变量);
    @{代码段}