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


C# CodeDom.CodeArgumentReferenceExpression类代码示例

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


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

示例1: EmitArgumentReference

 void EmitArgumentReference(CodeArgumentReferenceExpression Argument)
 {
     Depth++;
     Debug("Emitting argument reference");
     Generator.Emit(OpCodes.Ldarg, 0); // for now only used to refer to the sole object[] parameter
     Depth--;
 }
开发者ID:pschuegr,项目名称:IronAHK,代码行数:7,代码来源:EmitVars.cs

示例2: DefaultConstructor

		public void DefaultConstructor ()
		{
			CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ();
			Assert.AreEqual (string.Empty, care.ParameterName, "#1");
			care.ParameterName = "mono";
			Assert.AreEqual ("mono", care.ParameterName, "#2");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeArgumentReferenceExpressionTest.cs

示例3: BindingElementExtensionSectionGenerator

        internal BindingElementExtensionSectionGenerator(Type bindingElementType, Assembly userAssembly, CodeDomProvider provider)
        {
            this.bindingElementType = bindingElementType;
            this.userAssembly = userAssembly;
            this.provider = provider;

            string typePrefix = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement));
            this.generatedClassName = typePrefix + Constants.ElementSuffix;
            this.constantsClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.ConfigurationStrings;
            this.defaultValuesClassName = bindingElementType.Name.Substring(0, bindingElementType.Name.IndexOf(TypeNameConstants.BindingElement)) + Constants.Defaults;

            this.customBEVarInstance = Helpers.TurnFirstCharLower(bindingElementType.Name);
            customBEArgRef = new CodeArgumentReferenceExpression(customBEVarInstance);

            this.customBETypeRef = new CodeTypeReference(bindingElementType.Name);
            this.customBETypeOfRef = new CodeTypeOfExpression(customBETypeRef);
            this.customBENewVarAssignRef = new CodeVariableDeclarationStatement(
                                                customBETypeRef,
                                                customBEVarInstance,
                                                new CodeObjectCreateExpression(customBETypeRef));
            this.bindingElementMethodParamRef = new CodeParameterDeclarationExpression(
                                                    CodeDomHelperObjects.bindingElementTypeRef,
                                                    Constants.bindingElementParamName);

        }
开发者ID:ssickles,项目名称:archive,代码行数:25,代码来源:BindingElementExtensionSectionGenerator.cs

示例4: NullParameter

		public void NullParameter ()
		{
			CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ((string) null);
			Assert.AreEqual (string.Empty, care.ParameterName, "#1");
			care.ParameterName = null;
			Assert.AreEqual (string.Empty, care.ParameterName, "#2");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeArgumentReferenceExpressionTest.cs

示例5: TypescriptArgumentReferenceExpression

 public TypescriptArgumentReferenceExpression(
     CodeArgumentReferenceExpression codeExpression, 
     CodeGeneratorOptions options)
 {
     _codeExpression = codeExpression;
     _options = options;
     System.Diagnostics.Debug.WriteLine("TypescriptArgumentReferenceExpression Created");
 }
开发者ID:s2quake,项目名称:TypescriptCodeDom,代码行数:8,代码来源:TypescriptArgumentReferenceExpression.cs

示例6: GenerateRenderMemberMethod

        // Generate the CodeDom for our render method
        internal CodeMemberMethod GenerateRenderMemberMethod(string virtualPath)
        {
            Control container = Parent;

            string physicalPath = HostingEnvironment.MapPath(virtualPath);

            CodeMemberMethod renderMethod = new CodeMemberMethod();
            renderMethod.Name = RenderMethodName;
            renderMethod.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "__srh"));

            // REVIEW: we need support for CodeArgumentReferenceExpression, as using a snippet is
            // not guanranteed to be language agnostic
            CodeExpression snippetRenderHelper = new CodeArgumentReferenceExpression("__srh");

            // Go through all the children to build the CodeDOM tree
            for (int controlIndex = 0; controlIndex < container.Controls.Count; controlIndex++) {
                Control c = container.Controls[controlIndex];

                if (!(c is SnippetControl || c is ExpressionSnippetControl)) {

                    // If it's a regular control, generate a call to render it based on its index

                    CodeExpression method = new CodeMethodInvokeExpression(snippetRenderHelper, "RenderControl",
                        new CodePrimitiveExpression(controlIndex));
                    renderMethod.Statements.Add(new CodeExpressionStatement(method));

                    continue;
                }

                BaseCodeControl codeControl = (BaseCodeControl)c;

                string code = codeControl.Code;
                CodeStatement stmt;

                if (codeControl is SnippetControl) {

                    // If it's a <% code %> block, just append the code as is

                    stmt = new CodeSnippetStatement(code);
                } else {

                    // If it's a <%= expr %> block, generate a call to render it

                    CodeExpression method = new CodeMethodInvokeExpression(snippetRenderHelper, "Render",
                        new CodeSnippetExpression(code));
                    stmt = new CodeExpressionStatement(method);
                }

                stmt.LinePragma = new CodeLinePragma(physicalPath, codeControl.Line);
                renderMethod.Statements.Add(stmt);
            }

            return renderMethod;
        }
开发者ID:TerabyteX,项目名称:main,代码行数:55,代码来源:SnippetControl.cs

示例7: EmitApply

      	public override void EmitApply (CodeMemberMethod apply, CodeArgumentReferenceExpression proj,
					CodeArgumentReferenceExpression declloc, 
					CodeArgumentReferenceExpression log, 
					CodeVariableReferenceExpression pb,
					CodeVariableReferenceExpression tb)
	{
	    apply.Statements.Add (new CodeCommentStatement ("Create provider for param " +
							    basisparam));

	    CodeMethodInvokeExpression mie = new CodeMethodInvokeExpression ();
	    mie.Method = new CodeMethodReferenceExpression (proj, "EnsureProvider");
	    mie.Parameters.Add (new CodeFieldReferenceExpression (CDH.This, basisparam));
	    mie.Parameters.Add (declloc);

	    apply.Statements.Add (new CodeAssignStatement (pb, mie));

	    // Tell the PB about our Structure arguments so it can
	    // use them to instantiate the objects we reference.
	    // FIXME: catch if the provider references a rule or template 
	    // that requires a structure we don't have.

	    //if (Structure != null) {
	    mie = new CodeMethodInvokeExpression ();
	    mie.Method = new CodeMethodReferenceExpression (pb, "AddContextStructure");
	    mie.Parameters.Add (CDH.This);
	    apply.Statements.Add (mie);

	    foreach (string param in Structure.Parameters) {
		if (Structure[param] != StructureParameterKind.Structure)
		    continue;
		
		mie = new CodeMethodInvokeExpression ();
		mie.Method = new CodeMethodReferenceExpression (pb, "AddContextStructure");
		mie.Parameters.Add (new CodeFieldReferenceExpression (CDH.This, param));
		apply.Statements.Add (mie);
	    }
	    //}

	    foreach (BGTargetBuilder iter in targs)
		iter.EmitApply (apply, pb, tb, log);

	    foreach (string key in lits.Keys) {
		CodeExpression val = CDH.ResultExpression (lits[key]);

		CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression ();
		cmie.Method = new CodeMethodReferenceExpression (pb, "DefineConstantTarget");
		cmie.Parameters.Add (new CodePrimitiveExpression (key));
		cmie.Parameters.Add (val);
		cmie.Parameters.Add (log);

		apply.Statements.Add (CDH.IfTrueReturnTrue (cmie));
	    }
	}
开发者ID:emtees,项目名称:old-code,代码行数:53,代码来源:BGProviderBuilder.cs

示例8: GenerateCode

		public CodeNamespace GenerateCode(XmlReader reader)
		{
			CodeTypeDeclaration templateType = new CodeTypeDeclaration(defaultTypeName);
			templateType.Attributes = MemberAttributes.Family;
			templateType.IsPartial = true;
			CodeNamespace templateNamespace = new CodeNamespace(defaultTargetNamespace);
			templateNamespace.Types.Add(templateType);
			AddCommonImports(templateNamespace);

			CodeMemberMethod renderMethod = new CodeMemberMethod();
			renderMethod.Name = "Render";
			renderMethod.Attributes = MemberAttributes.Public | MemberAttributes.Final;
			renderMethod.Parameters.Add(new CodeParameterDeclarationExpression(
				typeof(XmlWriter), "writer"));

			CodeArgumentReferenceExpression writerExpression = new CodeArgumentReferenceExpression("writer");
			templateType.Members.Add(renderMethod);

			templateType.Members.Add(BuildConverter());

			while (reader.Read())
			{
				if (reader.NodeType == XmlNodeType.ProcessingInstruction)
				{
					ThrowIfUnknownInstruction(reader);

					if (typeInstructions.ContainsKey(reader.LocalName))
					{
						ITypeInstruction ti = typeInstructions[reader.LocalName];
						ti.Process(reader.Value, templateNamespace, templateType, renderMethod);
					}
					if (inlineInstructions.ContainsKey(reader.LocalName))
					{
						IInlineInstruction ii = inlineInstructions[reader.LocalName];
						CodeStatementCollection col = ii.Process(reader.Value);
						renderMethod.Statements.AddRange(col);
					}
				}
				else
				{
					renderMethod.Statements.AddRange(
						generationFunctions[reader.NodeType](reader, writerExpression));
				}
			}

			return templateNamespace;
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:47,代码来源:XmlCodeGenerator.cs

示例9: GenerateConstructor

        public static void GenerateConstructor(CodeTypeDeclaration classDecl)
        {
            CodeConstructor constructorMember = new CodeConstructor() ;

            constructorMember.Attributes = MemberAttributes.Public;

            CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(new CodeTypeReference("IContext"), "context");
            constructorMember.Parameters.Add(parameter);

            CodeThisReferenceExpression thisExp = new CodeThisReferenceExpression();
            CodeFieldReferenceExpression ctxFieldExp = new CodeFieldReferenceExpression(thisExp, "context");

            CodeArgumentReferenceExpression argExp = new CodeArgumentReferenceExpression("context");
            CodeAssignStatement assignStatement = new CodeAssignStatement(ctxFieldExp, argExp);
            constructorMember.Statements.Add(assignStatement);

            classDecl.Members.Add(constructorMember);
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:18,代码来源:CodeDomGenerator.cs

示例10: GetKeywordFromCodeDom

		public void GetKeywordFromCodeDom()
		{
			CodeStatement st = new CodeExpressionStatement(new CodeArgumentReferenceExpression("foo"));
			CodeExpression exp = new CodeArgumentReferenceExpression("foo");
			CodeIterationStatement it = new CodeIterationStatement(st, exp, st);

			CodeConditionStatement cond = new CodeConditionStatement(exp);

			new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromStatement(
				it, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());
			new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromStatement(
				cond, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());

			new Microsoft.VisualBasic.VBCodeProvider().GenerateCodeFromStatement(
				it, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());
			new Microsoft.VisualBasic.VBCodeProvider().GenerateCodeFromStatement(
				cond, Console.Out, new System.CodeDom.Compiler.CodeGeneratorOptions());
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:18,代码来源:RegexTests.cs

示例11: GenerateExecuteQueryBody

        public CodeStatement GenerateExecuteQueryBody(CodeMemberMethod method)
        {
            var dataAccessReference = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), DataAccessVariableName);
            var methodArgumentReferences = new CodeArgumentReferenceExpression[method.Parameters.Count];

            for (int i = 0; i < method.Parameters.Count; i++)
            {
                methodArgumentReferences[i] = new CodeArgumentReferenceExpression(method.Parameters[i].Name);
            }

            var invocationExpression = new CodeMethodInvokeExpression(dataAccessReference, ExecuteSqlQueryMethodName, methodArgumentReferences);

            if (method.ReturnType.BaseType != "System.Void")
            {
                return new CodeMethodReturnStatement(invocationExpression);
            }
            else
            {
                return new CodeExpressionStatement(invocationExpression);
            }
        }
开发者ID:swoog,项目名称:EaiConverter,代码行数:21,代码来源:DataAccessServiceBuilder.cs

示例12: addDispose

        static CodeMemberMethod addDispose(CodeTypeDeclaration ctd, CodeMemberMethod m, CodeMemberField fContainer)
        {
            CodeArgumentReferenceExpression ar0;
            CodeConditionStatement ccs, ccs1;
            CodeFieldReferenceExpression fr;

            ar0 = new CodeArgumentReferenceExpression("disposing");

            ctd.Members.Add(m = new CodeMemberMethod());
            m.Name = "Dispose";
            m.Attributes = MemberAttributes.Override | MemberAttributes.Family;
            m.Parameters.Add(new CodeParameterDeclarationExpression(typeof(bool), ar0.ParameterName));

            fr = new CodeFieldReferenceExpression(null, fContainer.Name);
            ccs = new CodeConditionStatement(ar0, ccs1 = new CodeConditionStatement());
            ccs1.Condition = new CodeBinaryOperatorExpression(
                fr,
                CodeBinaryOperatorType.IdentityInequality,
                new CodePrimitiveExpression());
            ccs1.TrueStatements.Add(
                new CodeExpressionStatement(
                    new CodeMethodInvokeExpression(fr, "Dispose")));
            m.Statements.AddRange(
                new CodeStatement[] {
                    ccs,
                    new CodeExpressionStatement(
                        new CodeMethodInvokeExpression(
                            new CodeBaseReferenceExpression(),
                            "Dispose",ar0))
            });
            m.Comments.AddRange(
                new CodeCommentStatement[]{
                    new CodeCommentStatement("<summary>\n Clean up any resources being used.\n </summary>",true)
                }
                );
            return m;
        }
开发者ID:surak8,项目名称:ProjectGen,代码行数:37,代码来源:CSGenerator.cs

示例13: GenerateArgumentReferenceExpression

 protected override void GenerateArgumentReferenceExpression(CodeArgumentReferenceExpression e)
 {
     this.OutputIdentifier(e.ParameterName);
 }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:4,代码来源:VBCodeGenerator.cs

示例14: AddStatementsToInitMethod

		protected override void AddStatementsToInitMethod (CodeMemberMethod method)
		{
#if NET_2_0
			AddStatementsFromDirective (method);
			ILocation directiveLocation = pageParser.DirectiveLocation;

			CodeArgumentReferenceExpression ctrlVar = new CodeArgumentReferenceExpression("__ctrl");
			if (pageParser.Title != null)
				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "Title", pageParser.Title), directiveLocation));

			if (pageParser.MasterPageFile != null)
				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "MasterPageFile", pageParser.MasterPageFile), directiveLocation));

			if (pageParser.Theme != null)
				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "Theme", pageParser.Theme), directiveLocation));

			if (pageParser.StyleSheetTheme != null)
				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "StyleSheetTheme", pageParser.StyleSheetTheme), directiveLocation));

			if (pageParser.Async != false)
				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "AsyncMode", pageParser.Async), directiveLocation));

			if (pageParser.AsyncTimeout != -1)
				method.Statements.Add (AddLinePragma (CreatePropertyAssign (ctrlVar, "AsyncTimeout",
											    TimeSpan.FromSeconds (pageParser.AsyncTimeout)), directiveLocation));

			CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression (thisRef, "InitializeCulture");
			method.Statements.Add (AddLinePragma (new CodeExpressionStatement (expr), directiveLocation));
#endif
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:30,代码来源:PageCompiler.cs

示例15: ExportMessages

		private CodeExpression[] ExportMessages (MessageDescriptionCollection messages, CodeMemberMethod method, bool return_args)
		{
			CodeExpression [] args = null;
			foreach (MessageDescription md in messages) {
				if (md.Direction == MessageDirection.Output) {
					if (md.Body.ReturnValue != null) {
						ExportDataContract (md.Body.ReturnValue);
						method.ReturnType = md.Body.ReturnValue.CodeTypeReference;
					}
					continue;
				}

				if (return_args)
					args = new CodeExpression [md.Body.Parts.Count];

				MessagePartDescriptionCollection parts = md.Body.Parts;
				for (int i = 0; i < parts.Count; i++) {
					ExportDataContract (parts [i]);

					method.Parameters.Add (
						new CodeParameterDeclarationExpression (
							parts [i].CodeTypeReference,
							parts [i].Name));

					if (return_args)
						args [i] = new CodeArgumentReferenceExpression (parts [i].Name);
				}
			}

			return args;
		}
开发者ID:anand-bhola,项目名称:mono,代码行数:31,代码来源:ServiceContractGenerator.cs


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