• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CodeDom.CodeMemberMethod类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Generate

        /// <summary>
        /// Generates control fields
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="classType">Type of the class.</param>
        /// <param name="method">The initialize method.</param>
        /// <param name="generateField">if set to <c>true</c> [generate field].</param>
        /// <returns></returns>
        public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod method, bool generateField)
        {
            CodeExpression fieldReference = new CodeThisReferenceExpression();

            CodeComHelper.GenerateBrushField(method, fieldReference, source, Control.BackgroundProperty);
            CodeComHelper.GenerateBrushField(method, fieldReference, source, Control.BorderBrushProperty);
            CodeComHelper.GenerateThicknessField(method, fieldReference, source, Control.BorderThicknessProperty);
            CodeComHelper.GenerateThicknessField(method, fieldReference, source, Control.PaddingProperty);
            CodeComHelper.GenerateBrushField(method, fieldReference, source, Control.ForegroundProperty);
            CodeComHelper.GenerateField<bool>(method, fieldReference, source, UIRoot.IsTabNavigationEnabledProperty);
            CodeComHelper.GenerateColorField(method, fieldReference, source, UIRoot.MessageBoxOverlayProperty);

            CodeComHelper.GenerateTemplateStyleField(classType, method, fieldReference, source, FrameworkElement.StyleProperty);

            Control control = source as Control;
            if (!CodeComHelper.IsDefaultValue(source, Control.FontFamilyProperty) ||
                !CodeComHelper.IsDefaultValue(source, Control.FontSizeProperty) ||
                !CodeComHelper.IsDefaultValue(source, Control.FontStyleProperty) ||
                !CodeComHelper.IsDefaultValue(source, Control.FontWeightProperty))
            {
                FontGenerator.Instance.AddFont(control.FontFamily, control.FontSize, control.FontStyle, control.FontWeight, method);
            }

            CodeComHelper.GenerateFontFamilyField(method, fieldReference, source, Control.FontFamilyProperty);
            CodeComHelper.GenerateFieldDoubleToFloat(method, fieldReference, source, Control.FontSizeProperty);
            CodeComHelper.GenerateFontStyleField(method, fieldReference, source, Control.FontStyleProperty, Control.FontWeightProperty);

            return fieldReference;
        }
开发者ID:EmptyKeys,项目名称:UI_Generator,代码行数:37,代码来源:UIRootGeneratorType.cs


示例2: ProcessGeneratedCode

 public override void ProcessGeneratedCode(CodeCompileUnit codeCompileUnit, CodeTypeDeclaration baseType, CodeTypeDeclaration derivedType, CodeMemberMethod buildMethod, CodeMemberMethod dataBindingMethod)
 {
     if (!String.IsNullOrWhiteSpace(Inherits))
     {
         derivedType.BaseTypes[0] = new CodeTypeReference(Inherits);
     }
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:7,代码来源:ViewUserControlControlBuilder.cs


示例3: AddCustomAttributesToMethod

 private void AddCustomAttributesToMethod(CodeMemberMethod dbMethod)
 {
     if (base.methodSource.EnableWebMethods)
     {
         CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("System.Web.Services.WebMethod");
         declaration.Arguments.Add(new CodeAttributeArgument("Description", CodeGenHelper.Str(base.methodSource.WebMethodDescription)));
         dbMethod.CustomAttributes.Add(declaration);
     }
     DataObjectMethodType select = DataObjectMethodType.Select;
     if (base.methodSource.CommandOperation == CommandOperation.Update)
     {
         select = DataObjectMethodType.Update;
     }
     else if (base.methodSource.CommandOperation == CommandOperation.Delete)
     {
         select = DataObjectMethodType.Delete;
     }
     else if (base.methodSource.CommandOperation == CommandOperation.Insert)
     {
         select = DataObjectMethodType.Insert;
     }
     if (select != DataObjectMethodType.Select)
     {
         dbMethod.CustomAttributes.Add(new CodeAttributeDeclaration(CodeGenHelper.GlobalType(typeof(DataObjectMethodAttribute)), new CodeAttributeArgument[] { new CodeAttributeArgument(CodeGenHelper.Field(CodeGenHelper.GlobalTypeExpr(typeof(DataObjectMethodType)), select.ToString())), new CodeAttributeArgument(CodeGenHelper.Primitive(false)) }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:FunctionGenerator.cs


示例4: PostProcessGeneratedCodeAddsApplicationInstanceProperty

        public void PostProcessGeneratedCodeAddsApplicationInstanceProperty() {
            const string expectedPropertyCode = @"
protected Foo.Bar ApplicationInstance {
    get {
        return ((Foo.Bar)(Context.ApplicationInstance));
    }
}
";

            // Arrange
            CodeCompileUnit generatedCode = new CodeCompileUnit();
            CodeNamespace generatedNamespace = new CodeNamespace();
            CodeTypeDeclaration generatedClass = new CodeTypeDeclaration();
            CodeMemberMethod executeMethod = new CodeMemberMethod();
            WebPageRazorHost host = new WebPageRazorHost("Foo.cshtml") {
                GlobalAsaxTypeName = "Foo.Bar"
            };

            // Act
            host.PostProcessGeneratedCode(generatedCode, generatedNamespace, generatedClass, executeMethod);

            // Assert
            CodeMemberProperty property = generatedClass.Members[0] as CodeMemberProperty;
            Assert.IsNotNull(property);

            CSharpCodeProvider provider = new CSharpCodeProvider();
            StringBuilder builder = new StringBuilder();
            using(StringWriter writer = new StringWriter(builder)) {
                provider.GenerateCodeFromMember(property, writer, new CodeDom.Compiler.CodeGeneratorOptions());
            }

            Assert.AreEqual(expectedPropertyCode, builder.ToString());
        }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:33,代码来源:WebPageRazorEngineHostTest.cs


示例5: SuggestedHandlerCompletionData

		public SuggestedHandlerCompletionData (MonoDevelop.Projects.Project project, CodeMemberMethod methodInfo, INamedTypeSymbol codeBehindClass, Location codeBehindClassLocation)
		{
			this.project = project;
			this.methodInfo = methodInfo;
			this.codeBehindClass = codeBehindClass;
			this.codeBehindClassLocation = codeBehindClassLocation;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:SuggestedHandlerCompletionData.cs


示例6: WriteFunctionDefinition

        protected override void WriteFunctionDefinition(CodeMemberMethod func) {
            Writer.Write("def ");
            Writer.Write(func.Name);
            Writer.Write("(");
            for (int i = 0; i < func.Parameters.Count; ++i) {
                if (i != 0) {
                    Writer.Write(",");
                }
                Writer.Write(func.Parameters[i].Name);
            }
            Writer.Write("):\n");

            int baseIndent = _indents.Peek();

            _generatedIndent += 4;

            foreach (CodeStatement stmt in func.Statements) {
                WriteStatement(stmt);
            }

            _generatedIndent -= 4;

            while (_indents.Peek() > baseIndent) {
                _indents.Pop();
            }
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:26,代码来源:PythonCodeDomCodeGen.cs


示例7: CodeLocalVariableBinder

 /// <summary>
 /// Initializes a new instance of the <see cref="CodeLocalVariableBinder"/> class
 /// with a local variable declaration.
 /// </summary>
 /// <param name="method">The method to add a <see cref="CodeTypeReference"/> to.</param>
 /// <param name="variableDeclaration">The variable declaration to add.</param>
 internal CodeLocalVariableBinder(CodeMemberMethod method, CodeVariableDeclarationStatement variableDeclaration)
 {
     Guard.NotNull(() => method, method);
     Guard.NotNull(() => variableDeclaration, variableDeclaration);
     this.method = method;
     this.variableDeclaration = variableDeclaration;
 }
开发者ID:Jedzia,项目名称:NStub,代码行数:13,代码来源:CodeLocalVariableBinder.cs


示例8: AddMethods

 internal void AddMethods(CodeTypeDeclaration dataSourceClass)
 {
     this.AddSchemaSerializationModeMembers(dataSourceClass);
     this.initExpressionsMethod = this.InitExpressionsMethod();
     dataSourceClass.Members.Add(this.PublicConstructor());
     dataSourceClass.Members.Add(this.DeserializingConstructor());
     dataSourceClass.Members.Add(this.InitializeDerivedDataSet());
     dataSourceClass.Members.Add(this.CloneMethod(this.initExpressionsMethod));
     dataSourceClass.Members.Add(this.ShouldSerializeTablesMethod());
     dataSourceClass.Members.Add(this.ShouldSerializeRelationsMethod());
     dataSourceClass.Members.Add(this.ReadXmlSerializableMethod());
     dataSourceClass.Members.Add(this.GetSchemaSerializableMethod());
     dataSourceClass.Members.Add(this.InitVarsParamLess());
     CodeMemberMethod initClassMethod = null;
     CodeMemberMethod initVarsMethod = null;
     this.InitClassAndInitVarsMethods(out initClassMethod, out initVarsMethod);
     dataSourceClass.Members.Add(initVarsMethod);
     dataSourceClass.Members.Add(initClassMethod);
     this.AddShouldSerializeSingleTableMethods(dataSourceClass);
     dataSourceClass.Members.Add(this.SchemaChangedMethod());
     dataSourceClass.Members.Add(this.GetTypedDataSetSchema());
     dataSourceClass.Members.Add(this.TablesProperty());
     dataSourceClass.Members.Add(this.RelationsProperty());
     if (this.initExpressionsMethod != null)
     {
         dataSourceClass.Members.Add(this.initExpressionsMethod);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:DatasetMethodGenerator.cs


示例9: RegisterClasspath

		private void RegisterClasspath(CodeMemberMethod composeMethod, XmlElement classpathElement, IList assemblies)
		{
			XmlNodeList children = classpathElement.ChildNodes;
			for (int i = 0; i < children.Count ; i++) 
			{
				if (children[i] is XmlElement) 
				{
					XmlElement childElement = (XmlElement) children[i];

					string fileName = childElement.GetAttribute(FILE);
					string urlSpec = childElement.GetAttribute(URL);

					UriBuilder url = null;
					if (urlSpec != null && urlSpec.Length > 0) 
					{
						url = new UriBuilder(urlSpec);
						assemblies.Add(url.ToString());
					} 
					else 
					{
						if (!File.Exists(fileName)) 
						{
							throw new IOException(Environment.CurrentDirectory + Path.DirectorySeparatorChar + fileName + " doesn't exist");
						}

						assemblies.Add(fileName);
					}
				}
			}
		}
开发者ID:smmckay,项目名称:picocontainer,代码行数:30,代码来源:XMLContainerBuilder.cs


示例10: ExampleDependencyInjectionLogic

 public static void ExampleDependencyInjectionLogic(CodeMemberMethod buildMethod)
 {
     // Non file based controls are different than file based controls.
       // Non file based controls are instantiated with "new" inside of a method and returned.
       // They are declared in the first statement.
       CodeVariableDeclarationStatement declaration = (CodeVariableDeclarationStatement)buildMethod.Statements[0];
       // Use the type of the declaration to get the type of the control.
       Type type = Type.GetType(declaration.Type.BaseType);
       // Standard reflection to get all of the properties. You could also look for fields.
       PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
       foreach(PropertyInfo property in properties) {
     // See if the property has the specific attribute we care about.
     object[] injectDeps = property.GetCustomAttributes(typeof(InjectDepAttribute), true);
     if(injectDeps.Length == 1) {
       // Create the code dom to perform the injection.
       // In this example, set the property to the literal the attribute was given.
       CodeStatement setProperty = new CodeAssignStatement(
     new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(declaration.Name), property.Name),
     new CodePrimitiveExpression((injectDeps[0] as InjectDepAttribute).Name + " (the builder method this is set in is '" + buildMethod.Name + "')")
       );
       // Add the statement to the list of statements that make up the builder method.
       // The last statement is the return statement that returns the control.
       // So we insert out injection statement(s) right before it.
       buildMethod.Statements.Insert(buildMethod.Statements.Count - 1, setProperty);
     }
       }
 }
开发者ID:jmatysczak,项目名称:DotNETPOCs,代码行数:27,代码来源:DIControlBuilder.cs


示例11: ProcessGeneratedCode

 public override void ProcessGeneratedCode(
     CodeCompileUnit codeCompileUnit, CodeTypeDeclaration baseType,
     CodeTypeDeclaration derivedType, CodeMemberMethod buildMethod, CodeMemberMethod dataBindingMethod)
 {
     ExampleDependencyInjectionLogic(buildMethod);
       base.ProcessGeneratedCode(codeCompileUnit, baseType, derivedType, buildMethod, dataBindingMethod);
 }
开发者ID:jmatysczak,项目名称:DotNETPOCs,代码行数:7,代码来源:DIControlBuilder.cs


示例12: BuildAddContentPlaceHolderNames

        private void BuildAddContentPlaceHolderNames(CodeMemberMethod method, string placeHolderID) {
            CodePropertyReferenceExpression propertyExpr = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "ContentPlaceHolders");
            CodeExpressionStatement stmt = new CodeExpressionStatement();
            stmt.Expression = new CodeMethodInvokeExpression(propertyExpr, "Add", new CodePrimitiveExpression(placeHolderID.ToLower(CultureInfo.InvariantCulture)));

            method.Statements.Add(stmt);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:MasterPageCodeDomTreeGenerator.cs


示例13: GenerateWidgetCode

        static void GenerateWidgetCode(SteticCompilationUnit globalUnit, CodeNamespace globalNs, GenerationOptions options, List<SteticCompilationUnit> units, Gtk.Widget w, ArrayList warnings)
        {
            // Generate the build method

            CodeTypeDeclaration type = CreatePartialClass (globalUnit, units, options, w.Name);
            CodeMemberMethod met = new CodeMemberMethod ();
            met.Name = "Build";
            type.Members.Add (met);
            met.ReturnType = new CodeTypeReference (typeof(void));
            met.Attributes = MemberAttributes.Family;

            if (options.GenerateEmptyBuildMethod) {
                GenerateWrapperFields (type, Wrapper.Widget.Lookup (w));
                return;
            }

            met.Statements.Add (
                    new CodeMethodInvokeExpression (
                        new CodeTypeReferenceExpression (globalNs.Name + ".Gui"),
                        "Initialize",
                        new CodeThisReferenceExpression ()
                    )
            );

            Stetic.Wrapper.Widget wwidget = Stetic.Wrapper.Widget.Lookup (w);
            if (wwidget.GeneratePublic)
                type.TypeAttributes = TypeAttributes.Public;
            else
                type.TypeAttributes = TypeAttributes.NotPublic;

            Stetic.WidgetMap map = Stetic.CodeGenerator.GenerateCreationCode (globalNs, type, w, new CodeThisReferenceExpression (), met.Statements, options, warnings);
            CodeGenerator.BindSignalHandlers (new CodeThisReferenceExpression (), wwidget, map, met.Statements, options);
        }
开发者ID:mono,项目名称:stetic,代码行数:33,代码来源:CodeGeneratorPartialClass.cs


示例14: AddCustomAttributesToMethod

 private void AddCustomAttributesToMethod(CodeMemberMethod dbMethod)
 {
     DataObjectMethodType update = DataObjectMethodType.Update;
     if (base.methodSource.EnableWebMethods)
     {
         CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("System.Web.Services.WebMethod");
         declaration.Arguments.Add(new CodeAttributeArgument("Description", CodeGenHelper.Str(base.methodSource.WebMethodDescription)));
         dbMethod.CustomAttributes.Add(declaration);
     }
     if (base.MethodType != MethodTypeEnum.GenericUpdate)
     {
         if (base.activeCommand == base.methodSource.DeleteCommand)
         {
             update = DataObjectMethodType.Delete;
         }
         else if (base.activeCommand == base.methodSource.InsertCommand)
         {
             update = DataObjectMethodType.Insert;
         }
         else if (base.activeCommand == base.methodSource.UpdateCommand)
         {
             update = DataObjectMethodType.Update;
         }
         dbMethod.CustomAttributes.Add(new CodeAttributeDeclaration(CodeGenHelper.GlobalType(typeof(DataObjectMethodAttribute)), new CodeAttributeArgument[] { new CodeAttributeArgument(CodeGenHelper.Field(CodeGenHelper.GlobalTypeExpr(typeof(DataObjectMethodType)), update.ToString())), new CodeAttributeArgument(CodeGenHelper.Primitive(true)) }));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:UpdateCommandGenerator.cs


示例15: SetTestMethodCategories

		public override void SetTestMethodCategories(TestClassGenerationContext generationContext, CodeMemberMethod testMethod, IEnumerable<string> scenarioCategories)
		{
			IEnumerable<string> tags = scenarioCategories.ToList();

			IEnumerable<string> ownerTags = tags.Where(t => t.StartsWith(OWNER_TAG, StringComparison.InvariantCultureIgnoreCase)).Select(t => t);
			if(ownerTags.Any())
			{
				string ownerName = ownerTags.Select(t => t.Substring(OWNER_TAG.Length).Trim('\"')).FirstOrDefault();
				if(!String.IsNullOrEmpty(ownerName))
				{
					CodeDomHelper.AddAttribute(testMethod, OWNER_ATTR, ownerName);
				}
			}

			IEnumerable<string> workitemTags = tags.Where(t => t.StartsWith(WORKITEM_TAG, StringComparison.InvariantCultureIgnoreCase)).Select(t => t);
			if(workitemTags.Any())
			{
				int temp;
				IEnumerable<string> workitemsAsStrings = workitemTags.Select(t => t.Substring(WORKITEM_TAG.Length).Trim('\"'));
				IEnumerable<int> workitems = workitemsAsStrings.Where(t => int.TryParse(t, out temp)).Select(t => int.Parse(t));
				foreach(int workitem in workitems)
				{
					CodeDomHelper.AddAttribute(testMethod, WORKITEM_ATTR, workitem);
				}
			}

			CodeDomHelper.AddAttributeForEachValue(testMethod, CATEGORY_ATTR, GetNonMSTestSpecificTags(tags));
		}
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:28,代码来源:MsTest2010GeneratorProvider.cs


示例16: BuildTest

        public void BuildTest()
        {
            var typeMember = new CodeMemberMethod() { Name = "TypeMemberTest" };
            var propData = mocks.Stub<IBuilderData>();
            Expect.Call(buildcontext.TypeMember).Return(typeMember);
            //Expect.Call(buildcontext.GetBuilderData("Property")).Return(propData);

            // is not relevant ... just a devel-testing call to
            // "var userData = context.GetBuilderData<BuildParametersOfPropertyBuilder>(this);"
            Expect.Call(buildcontext.GetBuilderData<BuildParametersOfPropertyBuilder>(testObject)).Return(null);
            Expect.Call(buildcontext.GetBuilderData("Property")).Return(propData).Repeat.Any();
            var testClass = new CodeTypeDeclaration("TheClass");
            Expect.Call(buildcontext.TestClassDeclaration).Return(testClass).Repeat.Any();
            //Expect.Call(buildcontext.IsProperty).Return(true);
            mocks.ReplayAll();

            testObject.Build(this.buildcontext);

            // Todo: check if only the ending "Test" gets replaced.
            var expected = "TypeMemberNormalBehavior";
            var actual = typeMember.Name;
            Assert.AreEqual(expected, actual);

            mocks.VerifyAll();
        }
开发者ID:Jedzia,项目名称:NStub,代码行数:25,代码来源:PropertyBuilderTest.cs


示例17: Generate

        /// <summary>
        /// Generates code
        /// </summary>
        /// <param name="source">The dependence object</param>
        /// <param name="classType">Type of the class.</param>
        /// <param name="initMethod">The initialize method.</param>
        /// <param name="generateField"></param>
        /// <returns></returns>
        public override CodeExpression Generate(DependencyObject source, CodeTypeDeclaration classType, CodeMemberMethod initMethod, bool generateField)
        {
            CodeExpression fieldReference = base.Generate(source, classType, initMethod, generateField);
            CodeComHelper.GenerateEnumField<Stretch>(initMethod, fieldReference, source, ImageButton.ImageStretchProperty);

            ImageButton imageButton = source as ImageButton;
            BitmapImage bitmap = imageButton.ImageNormal as BitmapImage;
            if (bitmap != null)
            {
                CodeComHelper.GenerateBitmapImageField(initMethod, fieldReference, source, bitmap.UriSource, imageButton.Name + "_normal_bm", ImageButton.ImageNormalProperty);
            }

            bitmap = imageButton.ImageDisabled as BitmapImage;
            if (bitmap != null)
            {
                CodeComHelper.GenerateBitmapImageField(initMethod, fieldReference, source, bitmap.UriSource, imageButton.Name + "_disabled_bm", ImageButton.ImageDisabledProperty);
            }

            bitmap = imageButton.ImageHover as BitmapImage;
            if (bitmap != null)
            {
                CodeComHelper.GenerateBitmapImageField(initMethod, fieldReference, source, bitmap.UriSource, imageButton.Name + "_hover_bm", ImageButton.ImageHoverProperty);
            }

            bitmap = imageButton.ImagePressed as BitmapImage;
            if (bitmap != null)
            {
                CodeComHelper.GenerateBitmapImageField(initMethod, fieldReference, source, bitmap.UriSource, imageButton.Name + "_pressed_bm", ImageButton.ImagePressedProperty);
            }

            return fieldReference;
        }
开发者ID:EmptyKeys,项目名称:UI_Generator,代码行数:40,代码来源:ImageButtonGeneratorType.cs


示例18: Generate

        /// <summary>
        /// Generates code for value
        /// </summary>
        /// <param name="parentClass">The parent class.</param>
        /// <param name="method">The method.</param>
        /// <param name="value">The value.</param>
        /// <param name="baseName">Name of the base.</param>
        /// <param name="dictionary">The dictionary.</param>
        /// <returns></returns>
        public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
        {
            string bitmapVarName = baseName + "_bm";

            BitmapImage bitmap = value as BitmapImage;
            return CodeComHelper.GenerateBitmapImageValue(method, bitmap.UriSource, bitmapVarName);
        }
开发者ID:EmptyKeys,项目名称:UI_Generator,代码行数:16,代码来源:BitmapImageGeneratorValue.cs


示例19: GetInitializeMethod

 protected override CodeMemberMethod GetInitializeMethod(IDesignerSerializationManager manager, CodeTypeDeclaration typeDecl, object value)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     if (typeDecl == null)
     {
         throw new ArgumentNullException("typeDecl");
     }
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     CodeMemberMethod method = typeDecl.UserData[_initMethodKey] as CodeMemberMethod;
     if (method == null)
     {
         method = new CodeMemberMethod {
             Name = "InitializeComponent",
             Attributes = MemberAttributes.Private
         };
         typeDecl.UserData[_initMethodKey] = method;
         CodeConstructor constructor = new CodeConstructor {
             Attributes = MemberAttributes.Public
         };
         constructor.Statements.Add(new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), "InitializeComponent", new CodeExpression[0]));
         typeDecl.Members.Add(constructor);
     }
     return method;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:ActivityTypeCodeDomSerializer.cs


示例20: Visit

		public override void Visit(ActionTreeNode node)
		{
			CodeTypeDeclaration type = _typeStack.Peek();
			List<Type> actionArgumentTypes = new List<Type>();

			CodeMemberMethod method = new CodeMemberMethod();
			method.Name = node.Name;
			method.ReturnType = _source[typeof (IControllerActionReference)];
			method.Attributes = MemberAttributes.Public;
			method.CustomAttributes.Add(_source.DebuggerAttribute);
			List<CodeExpression> actionArguments = CreateActionArgumentsAndAddParameters(method, node, actionArgumentTypes);
			method.Statements.Add(
				new CodeMethodReturnStatement(CreateNewActionReference(node, actionArguments, actionArgumentTypes)));
			type.Members.Add(method);


			if (actionArguments.Count > 0 && _occurences[node.Name] == 1)
			{
				method = new CodeMemberMethod();
				method.Comments.Add(
					new CodeCommentStatement("Empty argument Action... Not sure if we want to pass MethodInformation to these..."));
				method.Name = node.Name;
				method.ReturnType = _source[typeof (IArgumentlessControllerActionReference)];
				method.Attributes = MemberAttributes.Public;
				method.CustomAttributes.Add(_source.DebuggerAttribute);
				method.Statements.Add(
					new CodeMethodReturnStatement(CreateNewActionReference(node, new List<CodeExpression>(), actionArgumentTypes)));
				type.Members.Add(method);
			}

			base.Visit(node);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:32,代码来源:ActionMapGenerator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CodeDom.CodeMemberProperty类代码示例发布时间:2022-05-26
下一篇:
C# CodeDom.CodeMemberField类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap