加个@            string s = @"1
                            2
                                3                            ";            MessageBox.Show(s);

解决方案 »

  1.   

    可以换行的,
    如果是字符串换行要加上+号

    String str = "1111111"+
                 "22222222"; 
               
      

  2.   

    我是在程序中加HTML代码时候出的错误
    str=@"..................
        "+@"................
        "+@"................"
      

  3.   

    换行是可以的,例如:
    if(typeStr.StartsWith("int")||
    typeStr.StartsWith("double")||
    typeStr.StartsWith("long")||
    typeStr.StartsWith("short")||
    typeStr.StartsWith("uint")||
    typeStr.StartsWith("float")||
    typeStr.StartsWith("decimal")||
    typeStr.StartsWith("ulong")||
    typeStr.StartsWith("ushort"))
    {
      return true;
    }在换行时,需要注意换行的位置,以及换行后语义的完整。
    否则,随意换行即使程序不报错,最终的代码可能也不是你想要的。