小编Pri*_*nda的帖子

在C#中使用stringbuilder在双引号后面附加字符

嗨,我想补充一下

<%@页面语言=“ C#” AutoEventWireup =“ true” CodeBehind =“ WebForm1.aspx.cs” Inherits =“ WebApplication1.WebForm1”%>

到文本文件,但是我被卡在“ C#”,“ WebForm1.aspx.cs”和“ WebApplication1.WebForm1”部分,我的代码如下

 public string HeaderContent1()
 {
     var sb = new StringBuilder();
     sb.Append("<%@ Page Language=");
     sb.Append("c#");// prints only c#
     sb.Append("AutoEventWireup=");
     sb.Append("true");
     sb.Append("CodeBehind=");
     sb.Append("WebForm1.aspx.cs");// prints only WebForm1.aspx.cs I want with double quotes
     sb.Append("WebApplication1.WebForm1");// prints only WebApplication1.WebForm1 I want with double quotes
     sb.Append("%>");

     sb.AppendLine();
     sb.Append("<html>");
     sb.AppendLine();// which is equal to Append(Environment.NewLine);
     sb.Append("<head>");
     sb.AppendLine();
     sb.Append("<h1>New File header</h1>");
     sb.AppendLine(); // which is equal to Append(Environment.NewLine);
     sb.Append("</head>");
     sb.AppendLine();
     sb.Append("<body>");
     sb.AppendLine(); // which …
Run Code Online (Sandbox Code Playgroud)

c# asp.net stringbuilder

-2
推荐指数
1
解决办法
8599
查看次数

标签 统计

asp.net ×1

c# ×1

stringbuilder ×1