當前位置: 首頁>>代碼示例>>C#>>正文


C# CodeWriter.Write方法代碼示例

本文整理匯總了C#中Mono.CodeGeneration.CodeWriter.Write方法的典型用法代碼示例。如果您正苦於以下問題:C# CodeWriter.Write方法的具體用法?C# CodeWriter.Write怎麽用?C# CodeWriter.Write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.CodeGeneration.CodeWriter的用法示例。


在下文中一共展示了CodeWriter.Write方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: PrintCode

 public override void PrintCode(CodeWriter cp)
 {
     exp.PrintCode (cp);
     cp.Write (" is ");
     cp.Write (type.FullName);
 }
開發者ID:yudhitech,項目名稱:xamarin-android,代碼行數:6,代碼來源:CodeIs.cs

示例12: 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

示例13: PrintCode

 public override void PrintCode(CodeWriter cp)
 {
     exp1.PrintCode (cp);
     cp.Write (" " + symbol + " ");
     exp2.PrintCode (cp);
 }
開發者ID:yudhitech,項目名稱:xamarin-android,代碼行數:6,代碼來源:CodeBinaryOperation.cs

示例14: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			cp.Write ("(");
			exp1.PrintCode (cp);
			cp.Write (" || ");
			exp2.PrintCode (cp);
			cp.Write (")");
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:8,代碼來源:CodeOr.cs

示例15: PrintCode

		public override void PrintCode (CodeWriter cp)
		{
			exp.PrintCode (cp);
			cp.Write ("++");
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:5,代碼來源:CodeIncrement.cs


注:本文中的Mono.CodeGeneration.CodeWriter.Write方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。