获取字符串定义以接受多行?

soo*_*ise 1 c# string

出于某种原因,下面的语法突出显示是我喜欢它的方式,但这不是它如何解释Visual Studio中的代码.当我尝试为字符串分配多行时,它不会让我.有没有办法我可以进行以下工作,而不是将我的所有代码合并到一行或每个新行使用+ =?

        string HtmlCode = "";
        HtmlCode =
            "
                <head>
                    <style>
                        *{margin: 0px;padding: 0px;font-family: Microsoft Sans Serif;font-size: 11px;}
                    </style>
                </head>
            ";
Run Code Online (Sandbox Code Playgroud)

Jul*_*rau 10

通过为字符串添加前缀来使用逐字字符串@

string HtmlCode = "";
HtmlCode =
        @"
            <head>
                <style>
                    *{margin: 0px;padding: 0px;font-family: Microsoft Sans Serif;font-size: 11px;}
                </style>
            </head>
        ";
Run Code Online (Sandbox Code Playgroud)