Compiler Error Message: CS1009: Unrecognized escape sequence

后端 未结 4 1196
名媛妹妹
名媛妹妹 2021-01-28 12:46
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your          


        
4条回答
  •  野性不改
    2021-01-28 13:10

    On line 44: you have 81 backslashes. On lines 45 and 46 you have 80 each. When used in a string literal, the backslash character is used as an "escape" character to indicate things like new-lines and tabs. If you actually want the backslash in your string, you need to specify 2 consecutive backslashes for each backslash desired. Since you have an odd number of backslashes on line 44, you are getting the error.

    If you really want that many backslashes, you can disable the escape character in C# by preceding the string literal with an @ like this:

    WriteLiteral(@"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
               + @"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
               + @"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
    

    Alternatively, you can delete one of the backslashes from line 44.

提交回复
热议问题