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


C# StringBuilder.AppendLine方法代码示例

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


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

示例1: ToString

        public override string ToString()
        {
            if (PageCount == 1)
                return "";

            var sb = new StringBuilder(512);

            sb.Append(@"<div class=""");
            sb.Append(CssClass);
            sb.Append(@""">");

            foreach (int pageSize in PageSizes)
            {
                sb.Append(@"<a href=""");
                sb.Append(HRef.Replace("pagesize=-1", "pagesize=" + pageSize));
                sb.Append(@""" title=""");
                sb.Append("show ");
                sb.Append(pageSize);
                sb.Append(@" items per page""");
                if (pageSize == CurrentPageSize)
                    sb.Append(@" class=""current page-numbers""");
                else
                    sb.Append(@" class=""page-numbers""");
                sb.Append(">");
                sb.Append(pageSize);
                sb.AppendLine("</a>");
            }
            sb.AppendLine(@"<span class=""page-numbers desc"">per page</span>");
            sb.Append("</div>");

            return sb.ToString();
        }
开发者ID:jango2015,项目名称:StackExchange.DataExplorer,代码行数:32,代码来源:PageSizer.cs

示例2: GetInfo

 public override string GetInfo()
 {
     var builder = new StringBuilder();
       builder.AppendLine("Auto balancing landing Leg");
       builder.AppendLine("By KerboKatz");
       return builder.ToString();
 }
开发者ID:Kerbas-ad-astra,项目名称:SmallUtilities,代码行数:7,代码来源:AutoBalancingLandingLeg.cs

示例3: AppendCustomInfo

 /// <summary>
 /// Appends "Exit after stopping" or "Stopping"
 /// </summary>
 /// <param name="customInfo">The autopilot block's custom info</param>
 public override void AppendCustomInfo(StringBuilder customInfo)
 {
     if (m_exitAfter)
         customInfo.AppendLine("Exit after stopping");
     else
         customInfo.AppendLine("Stopping");
 }
开发者ID:his1220,项目名称:Autopilot,代码行数:11,代码来源:Stopper.cs

示例4: GenerateSrcFiles

        public static string GenerateSrcFiles(string text, List<FileInfo> srcFiles, DirectoryInfo projectPath, string dirPrefix)
        {
            const string begin = "#BEGIN_AUTO_GENERATE_SRC_FILES";
            const string end = "#END_AUTO_GENERATE_SRC_FILES";

            int beginIndex = text.IndexOf(begin) + begin.Length;
            int endIndex = text.IndexOf(end);

            text = text.Remove(beginIndex, endIndex - beginIndex);
            StringBuilder result = new StringBuilder();
            result.AppendLine();
            result.AppendLine(@"LOCAL_SRC_FILES :=\");

            int i = srcFiles.Count;
            foreach (var fileInfo in srcFiles)
            {
                --i;
                string fileName = dirPrefix + fileInfo.FullName.Replace(projectPath.FullName, string.Empty).Remove(0, 1);
                fileName = fileName.Replace('\\', '/');
                if (i!=0)
                {
                    fileName += " \\";
                }

                result.AppendLine(fileName);
            }

            text = text.Insert(beginIndex, result.ToString());
            return text;
        }
开发者ID:whztt07,项目名称:Medusa,代码行数:30,代码来源:MedusaCoreAndroidProjectGenerator.cs

示例5: Introduce

 internal override string Introduce()
 {
     StringBuilder info = new StringBuilder();
     info.AppendLine("Boy: ");
     info.AppendLine(base.Introduce());
     return info.ToString();
 }
开发者ID:Rostech,项目名称:TelerikAcademyHomeworks,代码行数:7,代码来源:Boy.cs

示例6: FormatSql

        /// <summary>
        /// Formats the SQL in a SQL-Server friendly way, with DECLARE statements for the parameters up top.
        /// </summary>
        public string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null)
        {
            StringBuilder buffer = new StringBuilder();

            if (command != null && IncludeMetaData)
            {
                buffer.AppendLine("-- Command Type: " + command.CommandType);
                buffer.AppendLine("-- Database: " + command.Connection.Database);
                if (command.Transaction != null)
                {
                    buffer.AppendLine("-- Command Transaction Iso Level: " + command.Transaction.IsolationLevel);
                }
				if (Transaction.Current != null)
				{
					// transactions issued by TransactionScope are not bound to the database command but exists globally
					buffer.AppendLine("-- Transaction Scope Iso Level: " + Transaction.Current.IsolationLevel);
				}
                buffer.AppendLine();
            }

	        string baseOutput = base.FormatSql(commandText, parameters, command);

	        buffer.Append(baseOutput);

	        return buffer.ToString();
        }
开发者ID:BiYiTuan,项目名称:dotnet,代码行数:29,代码来源:VerboseSqlServerFormatter.cs

示例7: Dump

        public string Dump()
        {
            if (Results.Count == 0)
            {
                return "Overload resolution failed because there were no candidate operators.";
            }

            var sb = new StringBuilder();
            if (this.Best.HasValue)
            {
                sb.AppendLine("Overload resolution succeeded and chose " + this.Best.Signature.ToString());
            }
            else if (CountKind(OperatorAnalysisResultKind.Applicable) > 1)
            {
                sb.AppendLine("Overload resolution failed because of ambiguous possible best operators.");
            }
            else
            {
                sb.AppendLine("Overload resolution failed because no operator was applicable.");
            }

            sb.AppendLine("Detailed results:");
            foreach (var result in Results)
            {
                sb.AppendFormat("operator: {0} reason: {1}\n", result.Signature.ToString(), result.Kind.ToString());
            }

            return sb.ToString();
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:29,代码来源:BinaryOperatorOverloadResolutionResult.cs

示例8: BuildViewResult

        protected override void BuildViewResult(StringBuilder viewResult)
        {
            var bookings = this.Model as IEnumerable<Booking>;
            if (!bookings.Any())
            {
                viewResult.AppendLine("There are no bookings for this room.");
            }
            else
            {
                viewResult.AppendLine("Room bookings:");
            }

            foreach (var booking in bookings)
            {
                viewResult.AppendFormat(
                    "* {0:dd.MM.yyyy} - {1:dd.MM.yyyy} (${2:F2})",
                    booking.StartBookDate,
                    booking.EndBookDate,
                    booking.TotalPrice).AppendLine();

                viewResult.AppendFormat(
                    "Total booking price: ${0:F2}",
                    bookings.Sum(b => b.TotalPrice)).AppendLine();
            }
        }
开发者ID:kolev9605,项目名称:Fundamentals-Module,代码行数:25,代码来源:ViewBookings.cs

示例9: ToString

 public override string ToString()
 {
     var stringBuilder = new StringBuilder();
     stringBuilder.AppendLine(this.Name);
     stringBuilder.AppendLine(string.Join(", ", this.Ingredients));
     return stringBuilder.ToString();
 }
开发者ID:skloser,项目名称:High-Quality-Code,代码行数:7,代码来源:Pizza.cs

示例10: WriteRSAParamsToFile

        public void WriteRSAParamsToFile(string file)
        {
            using (var sw = new StreamWriter(new FileStream(file, FileMode.Append, FileAccess.Write)))
            {
                var sb = new StringBuilder();

                sb.AppendLine("class RsaStore");
                sb.AppendLine("{");

                // Write all private & public rsa parameters.
                WritePublicByteArray(ref sb, "D", RsaParams.D);
                WritePublicByteArray(ref sb, "DP", RsaParams.DP);
                WritePublicByteArray(ref sb, "DQ", RsaParams.DQ);
                WritePublicByteArray(ref sb, "Exponent", RsaParams.Exponent);
                WritePublicByteArray(ref sb, "InverseQ", RsaParams.InverseQ);
                WritePublicByteArray(ref sb, "Modulus", RsaParams.Modulus);
                WritePublicByteArray(ref sb, "P", RsaParams.P);
                WritePublicByteArray(ref sb, "Q", RsaParams.Q);

                sb.AppendLine("}");

                sw.WriteLine(sb.ToString());
            }

            // Reset all values
            RsaParams = new RSAParameters();
        }
开发者ID:4jb,项目名称:Arctium-WoD-Sandbox,代码行数:27,代码来源:RsaData.cs

示例11: ToString

        public override void ToString(StringBuilder builder)
        {
            builder.AppendFormatLine("Items: {0} (displayed: {1})", TotalItemCount, Items.Length);
            builder.AppendLine();

            foreach (var item in Items)
            {
                builder.AppendFormatLine("Auction Id: {0}  Item Entry: {1}", item.AuctionId, item.ItemEntry);

                for (uint i = 0; i < item.Enchantments.Length; ++i)
                {
                    var ench = item.Enchantments[i];
                    if (ench.Id != 0)
                        builder.AppendFormatLine("  Enchantment {0}: {1}", i, ench);
                }

                builder.AppendFormatLine("Property: {0}  RandomSuffix: {1}  Unknown: {2}",
                    item.PropertyId, item.SuffixFactor, item.Unknown);
                builder.AppendFormatLine("Stack Count: {0}  Charges: {1}", item.Count, item.SpellCharges);
                builder.AppendLine("Owner: " + item.Owner);
                builder.AppendFormatLine("Start Bid: {0}  Minimum Bid: {1}  BuyOut: {2}",
                    item.StartBid, item.MinimumBid, item.BuyOut);
                builder.AppendLine("Time Left: " + item.TimeLeftMs);
                builder.AppendFormatLine("Current Bid: {0}  Bidder: {1}", item.CurrentBid, item.CurrentBidder);

                builder.AppendLine();
            }

            builder.AppendLine("Delay: " + NextSearchDelayMs);
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:30,代码来源:AuctionListResult.cs

示例12: Parse

        public static Dictionary<string, string> Parse(string dataSource)
        {
            SortedList<string, SortedSet<string>> allCounters = PdhUtils.Parse(dataSource);
            var generated = new Dictionary<string, string>();

            foreach (string counterSet in allCounters.Keys)
            {
                string setName = NameUtils.CreateIdentifier(counterSet);

                var sb = new StringBuilder("// This code was generated by EtwEventTypeGen");
                sb.AppendLine(setName);
                sb.Append("namespace Tx.Windows.Counters.");
                sb.AppendLine(setName);
                sb.AppendLine();
                sb.AppendLine("{");

                foreach (string counter in allCounters[counterSet])
                {
                    EmitCounter(counterSet, counter, ref sb);
                }

                sb.AppendLine("}");
                generated.Add(setName, sb.ToString());
            }

            return generated;
        }
开发者ID:modulexcite,项目名称:Tx,代码行数:27,代码来源:PerfCounterParser.cs

示例13: AssertValid

        internal static void AssertValid(this DbDatabaseMapping databaseMapping, bool shouldThrow)
        {
            var storageItemMappingCollection = databaseMapping.ToStorageMappingItemCollection();

            var errors = new List<EdmSchemaError>();
            storageItemMappingCollection.GenerateViews(errors);

            if (errors.Any())
            {
                var errorMessage = new StringBuilder();
                errorMessage.AppendLine();

                foreach (var error in errors)
                {
                    errorMessage.AppendLine(error.ToString());
                }

                if (shouldThrow)
                {
                    throw new MappingException(errorMessage.ToString());
                }

                Assert.True(false, errorMessage.ToString());
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:25,代码来源:DbDatabaseMappingExtensions.cs

示例14: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        ContentNavigation content = new ContentNavigation();

        DataSet data = new DataSet();

        string[] Vector = new string[6 + 1];
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        data = content.getAllContent(Convert.ToInt32(Session["siteId"]));

        foreach (DataTable table in data.Tables)
        {
            foreach (DataRow row in table.Rows)
            {

                string link = "<a href= CMS_MainSite.aspx?GroupId=" + Convert.ToInt32(row["ContId"]) + ">" + Convert.ToString(row["ContTitle"]) + "</a>";

                Vector[Convert.ToInt32(row["ContOrdPos"])] = link;
            }

        }

        for (int i = 1; i < Vector.Length; i++)
        {
            sb.AppendLine(Convert.ToString(Vector[i]));
        }
        sb.AppendLine("<hr /> <br/>");
        div_Group_Selector.InnerHtml = sb.ToString();
    }
开发者ID:hugovin,项目名称:shrimpisthefruitofthesea,代码行数:29,代码来源:Content.ascx.cs

示例15: DebugIsValid

		protected override void DebugIsValid(StringBuilder sb)
		{
			if (this.Items == null) return;
			sb.AppendLine($"# Invalid Bulk items:");
			foreach(var i in Items.Select((item, i) => new { item, i}).Where(i=>!i.item.IsValid))
				sb.AppendLine($"  operation[{i.i}]: {i.item}");
		}
开发者ID:niemyjski,项目名称:elasticsearch-net,代码行数:7,代码来源:BulkResponse.cs


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