当前位置: 首页>>代码示例>>C#>>正文


C# System.Text.StringBuilder.Append方法代码示例

本文整理汇总了C#中System.Text.StringBuilder.Append方法的典型用法代码示例。如果您正苦于以下问题:C# System.Text.StringBuilder.Append方法的具体用法?C# System.Text.StringBuilder.Append怎么用?C# System.Text.StringBuilder.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Text.StringBuilder的用法示例。


在下文中一共展示了System.Text.StringBuilder.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: export

 public void export(QuadNode node, List<System.Text.StringBuilder> result)
 {
     //List<string> _Result = new List<string>();
     System.Text.StringBuilder item = new System.Text.StringBuilder("");
     item.Append(String.Format("{0}\t{1}\t{2}\t{3}\t{4}",
                             node._id.ToString().Trim(),
                             node._bounds.X.ToString().Trim(),
                             node._bounds.Y.ToString().Trim(),
                             node._bounds.Width.ToString().Trim(),
                             node._bounds.Height.ToString().Trim()));
     if (node._nodeBL != null)
     {
         export(node._nodeBL, result);
         export(node._nodeBR, result);
         export(node._nodeTL, result);
         export(node._nodeTR, result);
     }
     else
     {
         for (int i = 0; i < node._listObject.Count;++i )
         {
             item.Append( "\t" + node._listObject[i]._id.ToString().Trim());
         }
     }
     result.Add(item);
 }
开发者ID:caontfuky,项目名称:map-editor-vs1,代码行数:26,代码来源:QuadTree.cs

示例2: EscapeIdentifier

        /// <summary>
        ///     Ensures that if the identifier contains a hyphen or other special characters that it will be escaped by tick (`) characters.
        /// </summary>
        /// <param name="identifier">The identifier to format</param>
        /// <returns>An escaped identifier, if escaping was required.  Otherwise the original identifier.</returns>
        public static string EscapeIdentifier(string identifier)
        {
            if (identifier == null)
            {
                throw new ArgumentNullException("identifier");
            }

            bool containsSpecialChar = false;
            for (var i = 0; i < identifier.Length; i++)
            {
                if (!Char.IsLetterOrDigit(identifier[i]))
                {
                    containsSpecialChar = true;
                    break;
                }
            }

            if (!containsSpecialChar)
            {
                return identifier;
            }
            else
            {
                var sb = new System.Text.StringBuilder(identifier.Length + 2);

                sb.Append('`');
                sb.Append(identifier.Replace("`", "``"));
                sb.Append('`');
                return sb.ToString();
            }
        }
开发者ID:yonglehou,项目名称:Linq2Couchbase,代码行数:36,代码来源:N1QLQueryModelVisitor.cs

示例3: ToString

        /// <summary></summary>
        /// <returns></returns>
        public override string ToString()
        {
            /*
            function<out Function func> =	(. func = new Function();
                                    Expression exp = null;
                                .)
            ident						(. func.Name = t.val; .)
            '(' expr<out exp>			(. func.Expression = exp; .)
            ')'
            .
            */
            System.Text.StringBuilder txt = new System.Text.StringBuilder();
            txt.AppendFormat("{0}(", name);
            if (expression != null) {
                bool first = true;
                foreach (Term t in expression.Terms) {
                    //if (t.Value.EndsWith("=")) {
                    if (first) {
                        first = false;
                    } else if (t.Value != null && !t.Value.EndsWith("=")) {
                        txt.Append(", ");
                    }

                    bool quoteMe = false;
                    if (t.Type == TermType.String && !t.Value.EndsWith("=")) {
                        quoteMe = true;
                    }
                    if (quoteMe) { txt.Append("'"); }
                    txt.Append(t.ToString());
                    if (quoteMe) { txt.Append("'"); }
                }
            }
            txt.Append(")");
            return txt.ToString();
        }
开发者ID:xescrp,项目名称:breinstormin,代码行数:37,代码来源:Function.cs

示例4: GetCashSelectModel

        public SelectModel GetCashSelectModel(int pageIndex, int pageSize, string orderStr, int pledgeApplyId)
        {
            NFMT.Common.SelectModel select = new NFMT.Common.SelectModel();

            select.PageIndex = pageIndex;
            select.PageSize = pageSize;
            if (string.IsNullOrEmpty(orderStr))
                select.OrderStr = "psd.ContractNo desc";
            else
                select.OrderStr = orderStr;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(" psd.ContractNo as StockContractNo,psd.Deadline,SUM(Hands) as Hands,bank.BankName as AccountName ");
            select.ColumnName = sb.ToString();

            sb.Clear();
            sb.Append(" dbo.Fin_PledgeApply pa ");
            sb.AppendFormat(" inner join dbo.Fin_PledgeApplyStockDetail psd on pa.PledgeApplyId = psd.PledgeApplyId and psd.DetailStatus ={0} ", (int)Common.StatusEnum.已生效);
            sb.Append(" left join NFMT_Basic..Bank bank on pa.FinancingBankId = bank.BankId ");
            select.TableName = sb.ToString();

            sb.Clear();
            sb.AppendFormat(" pa.PledgeApplyId ={0} group by psd.ContractNo,psd.Deadline,bank.BankName ", pledgeApplyId);

            select.WhereStr = sb.ToString();

            return select;
        }
开发者ID:weiliji,项目名称:NFMT,代码行数:28,代码来源:PledgeApplyCashDetailBLL.cs

示例5: Log

        /// <summary>
        /// Logs a message to the console.
        /// </summary>
        /// <param name="style"> A style which influences the icon and text color. </param>
        /// <param name="objects"> The objects to output to the console. These can be strings or
        /// ObjectInstances. </param>
        public void Log(FirebugConsoleMessageStyle style, object[] objects)
        {
#if !SILVERLIGHT
            var original = Console.ForegroundColor;
            switch (style)
            {
                case FirebugConsoleMessageStyle.Information:
                    Console.ForegroundColor = ConsoleColor.White;
                    break;
                case FirebugConsoleMessageStyle.Warning:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    break;
                case FirebugConsoleMessageStyle.Error:
                    Console.ForegroundColor = ConsoleColor.Red;
                    break;
            }
#endif

            // Convert the objects to a string.
            var message = new System.Text.StringBuilder();
            for (int i = 0; i < objects.Length; i++)
            {
                message.Append(' ');
                message.Append(TypeConverter.ToString(objects[i]));
            }

            // Output the message to the console.
            Console.WriteLine(message.ToString());


#if !SILVERLIGHT
            if (style != FirebugConsoleMessageStyle.Regular)
                Console.ForegroundColor = original;
#endif
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:41,代码来源:StandardConsoleOutput.cs

示例6: DetermineRecipientCount

        protected string DetermineRecipientCount()
        {
            string strCounties = (AllCounties.Checked) ? "All" : Session["Criteria-County"].ToString();
            string strSchools = (AllSchools.Checked) ? "All" : Session["Criteria-School"].ToString();
            string strGrades = (AllGrades.Checked) ? "All" : Session["Criteria-Grade"].ToString();
            string strCareers = (AllCareers.Checked) ? "All" : Session["Criteria-Career"].ToString();
            string strClusters = (AllClusters.Checked) ? "All" : Session["Criteria-Cluster"].ToString();
            string strGender = Session["GenderChoice"].ToString();

            System.Text.StringBuilder sbSQL = new System.Text.StringBuilder();
            sbSQL.Append("select count(portfolioid) from PortfolioUserInfo where active=1 and ConSysID=" + ConSysID);

            if (strGender != "All")
                sbSQL.Append(" and GenderID in (" + strGender + ")");
            if (strGrades != "All")
                sbSQL.Append(" and GradeNumber in (" + strGrades + ")");
            if (strSchools != "All")
                sbSQL.Append(" and SchoolID in (" + strSchools + ")");
            if (strCounties != "All")
                sbSQL.Append(" and CountyID in (" + strCounties + ")");
            if (strCareers != "All")
                sbSQL.Append(" and PortfolioID in (Select PortfolioID from Port_SavedCareers where OccNumber in (" + strCareers + "))");
            if (strClusters != "All")
                sbSQL.Append(" and PortfolioID in (Select PortfolioID from Port_ClusterInterests where ClusterID in (" + strClusters + "))");

            return CCLib.Common.DataAccess.GetValue(sbSQL.ToString()).ToString();
        }
开发者ID:nehawadhwa,项目名称:ccweb,代码行数:27,代码来源:TopMessageNew.aspx.cs

示例7: gvAnn_RowCommand

        protected void gvAnn_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("editRecord"))
            {
                dt = new DataTable();
                int index = Convert.ToInt32(e.CommandArgument);
                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                dt = ann.getAnnById((int)(gvAnn.DataKeys[index].Value));
                lblRowId.Text = dt.Rows[0]["Id"].ToString();
                ddlEditType.SelectedItem.Text = dt.Rows[0]["Type"].ToString();
                txtEditTitle.Text = dt.Rows[0]["Title"].ToString();
                txtEditContent.Text = dt.Rows[0]["Content"].ToString();

                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#updateModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditShowModalScript", sb.ToString(), false);
            }
            else if (e.CommandName.Equals("deleteRecord"))
            {
                int index = Convert.ToInt32(e.CommandArgument);
                string rowId = ((Label)gvAnn.Rows[index].FindControl("lblRowId")).Text;
                hfDeleteId.Value = rowId;

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('show');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteShowModalScript", sb.ToString(), false);
            }
        }
开发者ID:ismaeljaycarpio,项目名称:vs2013,代码行数:32,代码来源:Announcement.aspx.cs

示例8: ToString

		public override string ToString()
		{
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			sb.Append('<');
			object[] attr = GetType().GetCustomAttributes(typeof(XmlTypeAttribute), false);
			if (attr.Length == 1)
			{
				sb.Append(((XmlTypeAttribute)attr[0]).TypeName);
			}
			else
			{
				sb.Append(GetType().Name);
			}
			foreach (System.Reflection.FieldInfo field in GetType().GetFields())
			{
				if (!field.IsStatic)
				{
					object value = field.GetValue(this);
					if (value != null)
					{
						attr = field.GetCustomAttributes(typeof(XmlAttributeAttribute), false);
						if (attr.Length == 1)
						{
							sb.AppendFormat(" {0}=\"{1}\"", ((XmlAttributeAttribute)attr[0]).AttributeName, value);
						}
					}
				}
			}
			sb.Append(" />");
			return sb.ToString();
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:31,代码来源:remapper.cs

示例9: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions();
            urlOptions.AlwaysIncludeServerUrl = true;
            urlOptions.AddAspxExtension = true;
            urlOptions.LanguageEmbedding = LanguageEmbedding.Never;

            var homeItem = Sitecore.Context.Database.GetItem(Sitecore.Context.Site.StartPath.ToString());
            homePageUrl = Sitecore.Links.LinkManager.GetItemUrl(homeItem, urlOptions);

            //Add dynamic content to header
            HtmlHead head = (HtmlHead)Page.Header;

            //Add Open Tag
            if (Session["sess_User"] != null)
            {
                User objUser = (User)Session["sess_User"];
                if (objUser.Preferences != null)
                {
                    if (objUser.Preferences.MarketingCookies && objUser.Preferences.MetricsCookies)
                    {
                        head.Controls.Add(new LiteralControl(OpenTagHelper.OpenTagVirginActiveUK));
                    }
                }
            }

            //Add Page Title
            System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder();
            markupBuilder.Append(@"<meta name='viewport' content='width=1020'>");
            markupBuilder.Append(@"<link rel='apple-touch-icon' href='/virginactive/images/apple-touch-icon.png'>");
            markupBuilder.Append(@"<link rel='shortcut icon' href='/virginactive/images/favicon.ico'>");
            markupBuilder.Append(@"<link href='/virginactive/css/fonts.css' rel='stylesheet'>");
            markupBuilder.Append(@"<link href='/va_campaigns/css/campaign.css' rel='stylesheet'>");
            head.Controls.Add(new LiteralControl(markupBuilder.ToString()));
        }
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:35,代码来源:EndOfCampaign.ascx.cs

示例10: EXECommand

 public static int EXECommand(SqlCommand cmd, SqlConnection conn)
 {
     int i = 0;
     try
     {
         cmd.Connection = conn;
         if (conn.State != ConnectionState.Open)
             conn.Open();
         i = cmd.ExecuteNonQuery();
     }
     catch (SqlException _sqlException)
     {
         System.Text.StringBuilder err = new System.Text.StringBuilder();
         err.Append("Error executing [");
         err.Append(cmd.CommandText);
         //err.Append("]\nConnection String [");
         //err.Append(conn.ConnectionString);
         err.Append("]\nError [");
         err.Append(_sqlException.Message);
         err.Append("]");
         Logger.Write(err.ToString());
         return 0;
     }
     catch (InvalidOperationException _sqlException)
     {
         Logger.Write(_sqlException.Message);
     }
     finally
     {
         conn.Close();
     }
     return i;
 }
开发者ID:himanshujoshi19,项目名称:Test,代码行数:33,代码来源:Fileconection.cs

示例11: Process

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            base.Process(context, output);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            var existAttribute = output.Attributes["class"];
            if (existAttribute != null)
            {
                sb.Append(existAttribute.Value.ToString());
                sb.Append(" ");
            }

            if (this.Condition)
            {
                if (!string.IsNullOrWhiteSpace(this.TrueClass))
                {
                    sb.Append(this.TrueClass);
                }
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(this.FalseClass))
                {
                    sb.Append(this.FalseClass);
                }
            }

            if (sb.Length > 0)
            {
                output.Attributes.SetAttribute("class", sb.ToString());
            }
        }
开发者ID:scheshan,项目名称:DotNetClub,代码行数:33,代码来源:ConditionalClassTagHelper.cs

示例12: ToString

        /// <summary></summary>
        /// <returns></returns>
        public override string ToString()
        {
            /*
function<out Function func> =	(. func = new Function();
                                    Expression exp = null;
                                .)
    ident						(. func.Name = t.val; .)
    '(' expr<out exp>			(. func.Expression = exp; .)
    ')'
.
            */
            System.Text.StringBuilder txt = new System.Text.StringBuilder();
            txt.AppendFormat("{0}(", name);
            if (expression != null)
            {
                bool first = true;
                foreach (Term t in expression.Terms)
                {
                    //if (first) { first = false; } else { txt.Append(" "); }
                    txt.Append(t.ToString());
                }
            }
            txt.Append(")");
            return txt.ToString();
        }
开发者ID:Mofsy,项目名称:jinxbot,代码行数:27,代码来源:Function.cs

示例13: RecursiveFillTree

        private void RecursiveFillTree(DataTable dtParent, int ParentId)
        {
            level++; //on the each call level increment 1
            System.Text.StringBuilder appender = new System.Text.StringBuilder();

            for (int j = 0; j < level; j++)
            {
                appender.Append("&nbsp;&nbsp;&nbsp;&nbsp;");
            }
            if (level > 0)
            {
                appender.Append("|__");
            }

            DataView dv = new DataView(dtParent);
            dv.RowFilter = string.Format("ParentId = {0}", ParentId);

            int i;

            if (dv.Count > 0)
            {
                for (i = 0; i < dv.Count; i++)
                {
                    //DROPDOWNLIST
                    ddlTreeNode_Topics.Items.Add(new ListItem(Server.HtmlDecode(appender.ToString() + dv[i]["Gallery_TopicName"].ToString()), dv[i]["Gallery_TopicId"].ToString()));
                    RecursiveFillTree(dtParent, int.Parse(dv[i]["Gallery_TopicId"].ToString()));
                }
            }

            level--; //on the each function end level will decrement by 1
        }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:31,代码来源:admin_gallery_collection.ascx.cs

示例14: HighlightTerm

		public override System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup)
		{
			if (tokenGroup.GetTotalScore() == 0)
				return originalText;
			float score = tokenGroup.GetTotalScore();
			if (score == 0)
			{
				return originalText;
			}
			
			// try to size sb correctly
			System.Text.StringBuilder sb = new System.Text.StringBuilder(originalText.Length + EXTRA);
			
			sb.Append("<span style=\"");
			if (highlightForeground)
			{
				sb.Append("color: ");
				sb.Append(GetForegroundColorString(score));
				sb.Append("; ");
			}
			if (highlightBackground)
			{
				sb.Append("background: ");
				sb.Append(GetBackgroundColorString(score));
				sb.Append("; ");
			}
			sb.Append("\">");
			sb.Append(originalText);
			sb.Append("</span>");
			return sb.ToString();
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:31,代码来源:SpanGradientFormatter.cs

示例15: DictionaryToString

        /// <summary>
        /// Returns a string representation of this IDictionary.
        /// </summary>
        /// <remarks>
        /// The string representation is a list of the collection's elements in the order 
        /// they are returned by its IEnumerator, enclosed in curly brackets ("{}").
        /// The separator is a comma followed by a space i.e. ", ".
        /// </remarks>
        /// <param name="dict">Dictionary whose string representation will be returned</param>
        /// <returns>A string representation of the specified dictionary or "null"</returns>
        public static string DictionaryToString(IDictionary dict)
        {
            StringBuilder sb = new StringBuilder();

            if (dict != null)
            {
                sb.Append("{");
                int i = 0;
                foreach (DictionaryEntry e in dict)
                {
                    if (i > 0)
                    {
                        sb.Append(", ");
                    }

                    if (e.Value is IDictionary)
                        sb.AppendFormat("{0}={1}", e.Key.ToString(), DictionaryToString((IDictionary)e.Value));
                    else if (e.Value is IList)
                        sb.AppendFormat("{0}={1}", e.Key.ToString(), ListToString((IList)e.Value));
                    else
                        sb.AppendFormat("{0}={1}", e.Key.ToString(), e.Value.ToString());
                    i++;
                }
                sb.Append("}");
            }
            else
                sb.Insert(0, "null");

            return sb.ToString();
        }
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:40,代码来源:CollectionUtils.cs


注:本文中的System.Text.StringBuilder.Append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。