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


C# StringBuilder.WriteLine方法代码示例

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


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

示例1: DoWriteDelimitedComment

		private void DoWriteDelimitedComment(StringBuilder builder, string text)
		{
			int j = text.IndexOf("*/");
			if (j >= 0)
			{
				builder.WriteLine(text.Substring(0, j + 2));
				builder.WriteLine();
			}
		}
开发者ID:andyhebear,项目名称:Continuum,代码行数:9,代码来源:MoveSelectionToFile.cs

示例2: DoWriteUsing

		private void DoWriteUsing(StringBuilder builder, CsNamespace ns, string indent)
		{
			if (ns.Uses.Length > 0)
			{
				foreach (CsUsingDirective u in ns.Uses)
				{
					builder.WriteLine("{0}using {1};", indent, u.Namespace);
				}
				builder.WriteLine();
			}
		}
开发者ID:andyhebear,项目名称:Continuum,代码行数:11,代码来源:MoveSelectionToFile.cs

示例3: DoWriteSingleLineComments

		// Files often start with things like copyright notices which we want to preserve.
		private void DoWriteSingleLineComments(StringBuilder builder, string text)
		{
			int i = 0;
			
			while (i + 2 < text.Length && text[i] == '/' && text[i + 1] == '/')
			{
				int j = text.IndexOf('\n', i);
				if (j >= 0)
				{
					builder.WriteLine(text.Substring(i, j - i));
					i = j + 1;
				}
				else
					break;
			}
			builder.WriteLine();
		}
开发者ID:andyhebear,项目名称:Continuum,代码行数:18,代码来源:MoveSelectionToFile.cs

示例4: DoBuildNewFile

		private void DoBuildNewFile(string name, CsGlobalNamespace globals, CsDeclaration first, StringBuilder builder, string text, int offset, int length)
		{
			// If the file starts with a comment then write it out.
			if (text.Length > 2 && text[0] == '/' && text[1] == '/')
				DoWriteSingleLineComments(builder, text);
			else if (text.Length > 2 && text[0] == '/' && text[1] == '*')
				DoWriteDelimitedComment(builder, text);
			
			// Write the global using directives.
			DoWriteUsing(builder, globals, string.Empty);
			
			// Write the namespace the declaration was in.
			CsNamespace ns = DoGetNamespace(first);
			if (ns != null && ns.Name != "<globals>")
			{
				builder.WriteLine("namespace {0}{1}{2}", ns.Name, Constants.Bullet, "{");
				DoWriteUsing(builder, ns, "\t");
			}
			
			// If we're moving a member then create a dummy type.
			CsMember member = first as CsMember;
			if (member != null && member.DeclaringType != null)
			{
				string keyword = "?";
				if (member.DeclaringType is CsClass)
					keyword = "class";
				else if (member.DeclaringType is CsInterface)
					keyword = "interface";
				else if (member.DeclaringType is CsStruct)
					keyword = "struct";
					
				string modifiers;
				if (member.DeclaringType != null)
					modifiers = member.DeclaringType.Modifiers.ToString().ToLower();
				else
					modifiers = member.Modifiers.ToString().ToLower();
				modifiers = modifiers.Replace(",", string.Empty);
				
				builder.WriteLine("\t{0} {1} {2}", modifiers, keyword, name);
				builder.WriteLine("\t{");
			}
			
			// Write the selection.
			builder.Write(text.Substring(offset, length));
			
			// Close up type and namespaces.
			if (member != null && member.DeclaringType != null)
				builder.WriteLine("\t}");
			
			if (ns  != null && ns.Name != "<globals>")
				builder.WriteLine("}");
		}
开发者ID:andyhebear,项目名称:Continuum,代码行数:52,代码来源:MoveSelectionToFile.cs

示例5: GetStatsString

        public static string GetStatsString(string compiler, ICompilerCache cache)
        {
            var sb = new StringBuilder();
            sb.WriteLine("compiler: {0}", compiler);
            sb.WriteLine("cachedir: {0}", Settings.CacheDirectory);
            if (Settings.DebugEnabled)
            {
                sb.WriteLine("debug file: {0}", Settings.DebugFile);
            }
            if (Settings.Disabled)
            {
                sb.WriteLine("disabled: yes");
            }
            else
            {
                sb.WriteLine("disabled: no");
            }
            if (compiler != null)
            {
                if (cache != null)
                {
                    var stats = new CacheInfo(cache.OutputCache);

                    sb.WriteLine("outputCache usage: {0} kb", (int)(stats.CacheSize / 1024));
                    sb.WriteLine("cached files: {0}", stats.CacheObjects);
                    sb.WriteLine("hits: {0}", stats.CacheHits);
                    sb.WriteLine("misses: {0}", stats.CacheMisses);
                    sb.WriteLine("unsupported: {0}", stats.CacheUnsupported);
                    sb.WriteLine("slow hits: {0}", stats.SlowHitCount);
                }
            }
            return sb.ToString();
        }
开发者ID:artillery,项目名称:cclash,代码行数:33,代码来源:StatOutputs.cs

示例6: SVGGeometryOutput

 public SVGGeometryOutput(StringBuilder stringOut)
 {
     sb = stringOut;
     sb.WriteLine("<?xml version='1.0' encoding='UTF-8' standalone='no'?>");
     sb.WriteLine("<!-- created with Enchanted Gears (http://www.enchantedage.com/gears) -->");
     sb.WriteLine("<svg xmlns:dc='http://purl.org/dc/elements/1.1/'");
     sb.WriteLine(" xmlns:cc='http://creativecommons.org/ns#'");
     sb.WriteLine(" xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'");
     sb.WriteLine(" xmlns:svg='http://www.w3.org/2000/svg'");
     sb.WriteLine(" xmlns='http://www.w3.org/2000/svg'");
     sb.WriteLine(" version='1.1'");
     sb.WriteLine(" width='1000'");
     sb.WriteLine(" height='1000'");
     sb.WriteLine(" id='gears-svg'>");
     sb.WriteLine("<defs id='defs-dummy' />");
     sb.WriteLine("<circle id='center' fill='none' stroke='#808080' cx='500' cy='500' r='10' />");
 }
开发者ID:jwatte,项目名称:gears,代码行数:17,代码来源:GCodeGenerator.cs

示例7: GCodeGeometryOutput

 public GCodeGeometryOutput(StringBuilder stringOut)
 {
     feed = 1;
     sb = stringOut;
     sb.WriteLine("G20");        //  inches
     sb.WriteLine("G90");        //  absolute
     sb.WriteLine("G17");        //  XY plane
     sb.WriteLine("M3");         //  start spindle
 }
开发者ID:jwatte,项目名称:gears,代码行数:9,代码来源:GCodeGenerator.cs


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