我需要在+唱歌之间添加颜色。我可以把它包裹在一个范围内
ServicesCountLabelProperty.Text = "Report will contain " + (this.FilterHashCount.ServicesCount == 0 ? "0" : (string.Format("{0:0,0}", this.FilterHashCount.ServicesCount)).TrimStart(Convert.ToChar("0"))) + " errors(s).";
答案 0 :(得分:0)
将其包裹在一个范围内,然后你可以以任何你想要的方式设置样式。
string innerSpan = "<span class='someClass'>" +
(this.FilterHashCount.ServicesCount == 0 ? "0" :
(string.Format("{0:0,0}", this.FilterHashCount.ServicesCount)).TrimStart(Convert.ToChar("0"))) +
"</span>" ;
ServicesCountLabelProperty.Text = "Report will contain " + innerSpan + "errors(s)."