c#中这个格式字符串有什么问题?

时间:2015-10-01 09:05:39

标签: c# string formatting

我正在尝试删除这样的字符串:

string query = @"SELECT foo, bar
FROM table
WHERE id = 42";

,如Post Here

中所述

我的文字是:

editor.DocumentText = @"<html><body> <div align=\"left\"> <font face=\"Arial\" color=\"#0000ff\">
            <span style=\"font-size:8pt\">Multi-Room DVR Splash screen is displayed with the following:</span></font>";

但它会出错,

我明白我可以使用+并提供多行字符串:

editor.DocumentText = "<html><body> <div align=\"left\"> <font face=\"Arial\" color=\"#0000ff\">"+
            "<span style=\"font-size:8pt\">Multi-Room DVR Splash screen is displayed with the following:</span></font>";

这甚至可以正常工作。

我怀疑第一种声明方法是错误的原因,但同样适用于query示例。

0 个答案:

没有答案