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


C# CodeGeneration.CodeWriter类代码示例

本文整理汇总了C#中Mono.CodeGeneration.CodeWriter的典型用法代码示例。如果您正苦于以下问题:C# CodeWriter类的具体用法?C# CodeWriter怎么用?C# CodeWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PrintCode

		public string PrintCode ()
		{
			StringWriter sw = new StringWriter ();
			CodeWriter cw = new CodeWriter (sw);
			PrintCode (cw);
			return sw.ToString ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:CodeBuilder.cs

示例2: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			if (tryBlock == null) return;
			
			cp.Write ("try {");
			cp.Indent ();
			condition.PrintCode (cp);
			cp.Unindent ();
			foreach (DictionaryEntry de in catchBlocks) {
				CodeVariableDeclaration vd = (CodeVariableDeclaration) de.Key;
				cp.Write ("} catch (");
				if (vd.Variable.Name.Length > 0)
					vd.PrintCode (cp);
				else
					cp.Write (vd.Variable.Type.FullName);
				cp.Write (") {");
				cp.Indent ();
				((CodeBlock) de.Value).PrintCode (cp);
				cp.Unindent ();
			}
			if (!finallyBlock.IsEmpty) {
				cp.Write ("} finally {");
				cp.Indent ();
				finallyBlock.PrintCode (cp);
				cp.Unindent ();
			}
			cp.Write ("}");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:28,代码来源:CodeTryBlock.cs

示例3: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			foreach (CodeItem item in statements) {
				cp.BeginLine ();
				item.PrintCode (cp);
				cp.Write (";");
				cp.EndLine ();
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:CodeBlock.cs

示例4: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			cp.Write ("(");
			condition.PrintCode (cp);
			cp.Write (") ? ");
			trueBlock.PrintCode (cp);
			cp.Write (" : ");
			falseBlock.PrintCode (cp);
		}
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:CodeWhen.cs

示例5: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			if (object.ReferenceEquals (retValue, null))
				cp.Write ("return");
			else {
				cp.Write ("return ");
				retValue.PrintCode (cp);
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:CodeReturn.cs

示例6: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			if (!field.IsStatic)
				target.PrintCode (cp);
			else
				cp.Write (field.DeclaringType.Name);
			cp.Write (".");
			cp.Write (field.Name);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:CodeFieldReference.cs

示例7: PrintCode

 public override void PrintCode(CodeWriter cp)
 {
     cp.Write ("new " + type.Name + " (");
     for (int n=0; n<parameters.Length; n++) {
         if (n > 0) cp.Write (", ");
         parameters[n].PrintCode (cp);
     }
     cp.Write (")");
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:9,代码来源:CodeNew.cs

示例8: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			cp.Write ("while (");
			condition.PrintCode (cp);
			cp.Write (") {");
			cp.EndLine ();
			cp.Indent ();
			whileBlock.PrintCode (cp);
			cp.Unindent ();
			cp.BeginLine ().Write ("}");
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:CodeWhile.cs

示例9: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			cp.Write ("for (");
			initExp.PrintCode (cp);
			cp.Write (";");
			conditionExp.PrintCode (cp);
			cp.Write (";");
			nextExp.PrintCode (cp);
			cp.Write (") {");
			cp.EndLine ();
			cp.Indent ();
			forBlock.PrintCode (cp);
			cp.Unindent ();
			cp.BeginLine ().Write ("}");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:CodeFor.cs

示例10: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			if (trueBlock == null) return;
			
			cp.Write ("if (");
			condition.PrintCode (cp);
			cp.Write (") {");
			cp.EndLine ();
			cp.Indent ();
			trueBlock.PrintCode (cp);
			cp.Unindent ();
			cp.BeginLine ().Write ("}");
			if (falseBlock != null) {
				cp.EndLine ();
				cp.WriteLineInd ("else {");
				falseBlock.PrintCode (cp);
				cp.Unindent ();
				cp.BeginLine ().Write ("}");
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:20,代码来源:CodeIf.cs

示例11: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			for (int n=0; n<blocks.Count; n++) {
				if (n == 0)
					cp.Write ("if (");
				else
					cp.Write ("else if (");
				
				((CodeExpression)conditions[n]).PrintCode (cp);
				cp.Write (") {");
				cp.EndLine ();
				cp.Indent ();
				((CodeBlock) blocks[n]).PrintCode (cp);
				cp.Unindent ();
				cp.BeginLine ().Write ("}");
				if (n < blocks.Count - 1) {
					cp.EndLine ();
					cp.BeginLine ();
				}
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:21,代码来源:CodeSelect.cs

示例12: PrintCode

 public override void PrintCode(CodeWriter cp)
 {
     exp.PrintCode (cp);
     cp.Write (" is ");
     cp.Write (type.FullName);
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:6,代码来源:CodeIs.cs

示例13: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			cp.Write ("new " + elemType.Name + " [");
			size.PrintCode (cp);
			cp.Write ("]");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:CodeNewArray.cs

示例14: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			if (value is string)
				cp.Write ("\"").Write (value.ToString ()).Write ("\"");
			else if (value == null)
				cp.Write ("null");
			else if (value is Type)
				cp.Write ("typeof(" + ((Type)value).Name + ")");
			else if (value is Enum)
				cp.Write (value.GetType().Name + "." + value);
			else
				cp.Write (value.ToString ());
		}
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:CodeLiteral.cs

示例15: PrintCode

 public override void PrintCode(CodeWriter cp)
 {
     exp1.PrintCode (cp);
     cp.Write (" " + symbol + " ");
     exp2.PrintCode (cp);
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:6,代码来源:CodeBinaryOperation.cs


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