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


C# this.AppendLine方法代码示例

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


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

示例1: AppendSuggestImmutable

        internal static StringBuilder AppendSuggestImmutable(this StringBuilder errorBuilder, TypeErrors errors)
        {
            var fixableTypes = errors.AllErrors.OfType<TypeErrors>()
                                     .Where(x => x.Type != errors.Type)
                                     .Select(x => x.Type)
                                     .Distinct()
                                     .ToArray();
            if (!fixableTypes.Any())
            {
                return errorBuilder;
            }

            foreach (var type in fixableTypes)
            {
                var line = type.Assembly == typeof(int).Assembly
                    ? $"* Use an immutable type instead of {type.PrettyName()}."
                    : $"* Make {type.PrettyName()} immutable or use an immutable type.";
                errorBuilder.AppendLine(line);
            }

            errorBuilder.AppendLine("  - For immutable types the following must hold:")
                        .AppendLine("    - Must be a sealed class or a struct.")
                        .AppendLine("    - All fields and properties must be readonly.")
                        .AppendLine("    - All field and property types must be immutable.")
                        .AppendLine("    - All indexers must be readonly.")
                        .AppendLine("    - Event fields are ignored.");
            return errorBuilder;
        }
开发者ID:JohanLarsson,项目名称:Gu.State,代码行数:28,代码来源:StringBuilderExt.Errors.cs

示例2: AppendLine

		/// <summary>
		/// Appends the .ToString() value of the object supplied along with the default line terminator.
		/// </summary>
		public static StringBuilder AppendLine(this StringBuilder that, object value) {
			if (value == null) {
				return that.AppendLine();
			}
			else {
				return that.AppendLine(value.ToString());
			}
		}
开发者ID:MarcusPozzan,项目名称:dotmore,代码行数:11,代码来源:StringBuilderExtensions.cs

示例3: AppendTriggerable

        private static void AppendTriggerable(this StringBuilder builder, Triggerable triggerable)
        {
            builder.AppendLine("   [TRIGGERABLE]");

            builder.AppendFormat("      <STRING>Name:{0}\r\n", triggerable.Name);
            builder.AppendFormat("      <STRING>File:{0}\r\n", triggerable.File);

            builder.AppendLine("   [/TRIGGERABLE]");
        }
开发者ID:andreberg,项目名称:TLII.IO,代码行数:9,代码来源:TriggerableDataConverter.cs

示例4: IndentedLines

 public static void IndentedLines(this StringBuilder sb, String text)
 {
     string indent = new string(' ', tabs * 4);
     if (text.Contains("@\"")) //no splitting for verbatim strings
         sb.AppendLine(indent + text);
     else
         foreach (var line in text.Split('\n'))
             sb.AppendLine(indent + line.TrimEnd());
 }
开发者ID:petya2164,项目名称:ZsharpGameEditor,代码行数:9,代码来源:CodeGenerator.cs

示例5: AppendWatcherChangesetPart

        private static StringBuilder AppendWatcherChangesetPart(this StringBuilder sb, Dictionary<string, string> changesetPart, string name) {
            if (changesetPart.Count > 0) {
                sb.AppendLine(name);
                foreach (var item in changesetPart) {
                    sb.AppendLine($"{item.Key} -> {item.Value}");
                }
            }

            return sb;
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:10,代码来源:MsBuildFileSystemWatcherLoggingExtensions.cs

示例6: AppendConsoleFormat

        public static string AppendConsoleFormat(this StringBuilder builder)
        {
            builder.AppendLine("Retrieving the amount of customers and orders per city in the USA:");
            builder.Append(Environment.NewLine);
            builder.AppendLine(string.Format("{0,-54} {1,11} {2,11}", "-".Repeat(54), "-".Repeat(11), "-".Repeat(11)));
            builder.AppendLine(string.Format("{0,-54} {1,11} {2,11}", "City", "Customers", "Orders"));
            builder.AppendLine(string.Format("{0,-54} {1,11} {2,11}", "-".Repeat(54), "-".Repeat(11), "-".Repeat(11)));

            return builder.ToString();
        }
开发者ID:nanotaboada,项目名称:dotnet,代码行数:10,代码来源:Extensions.cs

示例7: AppendConsoleFormat

        public static string AppendConsoleFormat(this StringBuilder builder)
        {
            builder.AppendLine("1. Created by loading the XML file, displaying first 3 elements:");
            builder.Append(Environment.NewLine);
            builder.AppendLine(string.Format("{0,-25} {1,-25} {2,-15} {3,10}", "-".Repeat(25), "-".Repeat(25), "-".Repeat(15), "-".Repeat(10)));
            builder.AppendLine(string.Format("{0,-25} {1,-25} {2,-15} {3,-10}", "Title", "Author", "Published", "Price"));
            builder.AppendLine(string.Format("{0,-25} {1,-25} {2,-15} {3,10}", "-".Repeat(25), "-".Repeat(25), "-".Repeat(15), "-".Repeat(10)));

            return builder.ToString();
        }
开发者ID:nanotaboada,项目名称:dotnet,代码行数:10,代码来源:Extensions.cs

示例8: AppendLineFormat

 /// <summary>
 /// Appends a NewLine after the format string. Safe formatting for null/empty pArgs.
 /// </summary>
 /// <returns></returns>
 public static void AppendLineFormat(this StringBuilder pSb, string pFormat, params object[] pArgs)
 {
     if (pArgs != null && pArgs.Any())
     {
         pSb.AppendFormat(pFormat, pArgs);
         pSb.AppendLine();
     }
     else
         pSb.AppendLine(pFormat);
 }
开发者ID:akmurray,项目名称:aaronkmurray-blog-tools,代码行数:14,代码来源:ExtensionsForStringBuilder.cs

示例9: AppendSkill

        private static void AppendSkill(this StringBuilder builder, Skill skill)
        {
            builder.AppendLine("   [SKILL]");

            builder.AppendFormat("      <INTEGER64>GUID:{0}\r\n", skill.GUID);
            builder.AppendFormat("      <STRING>Name:{0}\r\n", skill.Name);
            builder.AppendFormat("      <STRING>File:{0}\r\n", skill.File);

            builder.AppendLine("   [/SKILL]");
        }
开发者ID:andreberg,项目名称:TLII.IO,代码行数:10,代码来源:SkillDataConverter.cs

示例10: AppendIfNotEmpty

 public static bool AppendIfNotEmpty( this StringBuilder sb, string line, int index, string pre = "" )
 {
     if( !string.IsNullOrEmpty( line ) )
     {
         if( !string.IsNullOrEmpty( pre ) )
             sb.AppendLine( pre );
         sb.AppendLine( "\t" + index + ": " + line );
         return true;
     }
     return false;
 }
开发者ID:Zazcallabah,项目名称:PokeSave,代码行数:11,代码来源:Extensions.cs

示例11: IndentAppendLines

 public static void IndentAppendLines(this StringBuilder b, int pad, string text)
 {
     foreach (var line in text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
     {
         if (string.IsNullOrWhiteSpace(line))
             b.AppendLine();
         else
         {
             b.Append(' ', pad); b.AppendLine(line);
         }
     }
 }
开发者ID:wow4all,项目名称:mooege,代码行数:12,代码来源:Extensions.cs

示例12: AppendLine

 /// <summary>
 /// Appends the format line.
 /// </summary>
 /// <param name="sb">The sb.</param>
 /// <param name="str">The STR.</param>
 /// <param name="args">The args.</param>
 public static void AppendLine(this StringBuilder sb, string str, params object[] args)
 {
     if (args == null || args.Length == 0)
     {
         sb.AppendLine(str);
     }
     else
     {
         sb.AppendFormat(str, args);
         sb.AppendLine();
     }
 }
开发者ID:apoco,项目名称:valleyofthesundogrescue,代码行数:18,代码来源:StringExtensions.cs

示例13: WriteHelpPage

        private static void WriteHelpPage(this StringBuilder sb, HelpPage page, int maxWidth)
        {
            sb.WriteUsage(page.ApplicationName, page.SyntaxElements, maxWidth);

            if (!page.Rows.Any())
                return;

            sb.AppendLine();

            sb.WriteRows(page.Rows, maxWidth);

            sb.AppendLine();
        }
开发者ID:TerabyteX,项目名称:corefxlab,代码行数:13,代码来源:HelpTextGenerator.cs

示例14: AppendUserInterface

        private static void AppendUserInterface(this StringBuilder builder, UserInterface userInterface)
        {
            builder.AppendLine("   [USERINTERFACE]");

            builder.AppendFormat("      <STRING>Name:{0}\r\n", userInterface.Name);
            builder.AppendFormat("      <STRING>File:{0}\r\n", userInterface.File);
            builder.AppendFormat("      <INTEGER>Unknown:{0}\r\n", userInterface.Unknown);
            builder.AppendFormat("      <INTEGER>Unknown2:{0}\r\n", userInterface.Unknown2);
            builder.AppendFormat("      <SHORT>Unknown3:{0}\r\n", userInterface.Unknown3);
            builder.AppendFormat("      <BOOL>Unknown4:{0:X2}\r\n", userInterface.Unknown4.Value ? "True" : "False");
            builder.AppendFormat("      <STRING>Unknown5:{0}\r\n", userInterface.Unknown5);

            builder.AppendLine("   [/USERINTERFACE]");
        }
开发者ID:andreberg,项目名称:TLII.IO,代码行数:14,代码来源:UserInterfaceDataConverter.cs

示例15: AppendLineFormat

        public static StringBuilder AppendLineFormat(this StringBuilder sb, string value, params object[] parameters)
        {
            if ((parameters == null) || (parameters.Length == 0))
                return sb.AppendLine(value);

            List<object> newparams = new List<object>();
            foreach (var p in parameters)
                if (p == null)
                    newparams.Add(string.Empty);
                else
                    newparams.Add(p);

            sb.AppendFormat(value, newparams.ToArray());
            return sb.AppendLine();
        }
开发者ID:drorgl,项目名称:MSDNSWebAdmin,代码行数:15,代码来源:StringBuilderExtensions.cs


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