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

C# CodeDom.CodeMemberEvent类代码示例

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

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



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

示例1: EventInfo

		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="tag">Tag</param>
		/// <param name="className">Class name</param>
		public EventInfo(CodeMemberEvent tag, string className) 
			: base(tag, className)
		{
			Trace.Assert(tag != null);
			name = tag.Name;
			lineNumber = tag.LinePragma.LineNumber;
		}
开发者ID:divyang4481,项目名称:lextudio,代码行数:12,代码来源:EventInfo.cs


示例2: ToCodeDom

        public override CodeTypeMember ToCodeDom()
        {
            CodeMemberEvent e = new CodeMemberEvent();
            base.ToCodeDom(e);
            e.Name  = this.Conformer.NormalizeMember(this.Name,this.Attributes);
            e.Type = this.Type.TypeReference;

            return e;
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:9,代码来源:EventDeclaration.cs


示例3: Constructor0_Deny_Unrestricted

		public void Constructor0_Deny_Unrestricted ()
		{
			CodeMemberEvent cme = new CodeMemberEvent ();
			Assert.AreEqual (0, cme.ImplementationTypes.Count, "ImplementationTypes");
			Assert.IsNull (cme.PrivateImplementationType, "PrivateImplementationType");
			cme.PrivateImplementationType = new CodeTypeReference ("System.Int32");
			Assert.AreEqual ("System.Void", cme.Type.BaseType, "Type");
			cme.Type = new CodeTypeReference ("System.Void");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:CodeMemberEventCas.cs


示例4: Event

        public static CodeMemberEvent Event(CodeTypeReference delegateType, MemberAttributes ma, string name)
        {
            var c = new CodeMemberEvent
            {
                Name = name,
                Attributes = ma,
                Type = delegateType,
            };

            return c;
        }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:11,代码来源:Event.cs


示例5: TypescriptMemberEvent

 public TypescriptMemberEvent(
     IExpressionFactory expressionFactory,
     ITypescriptTypeMapper typescriptTypeMapper,
     CodeMemberEvent member,
     CodeGeneratorOptions options)
 {
     _expressionFactory = expressionFactory;
     _typescriptTypeMapper = typescriptTypeMapper;
     _member = member;
     _options = options;
 }
开发者ID:s2quake,项目名称:TypescriptCodeDom,代码行数:11,代码来源:TypescriptMemberEvent.cs


示例6: DesignTimeEventInfo

 internal DesignTimeEventInfo(DesignTimeType declaringType, CodeMemberEvent codeDomEvent)
 {
     if (declaringType == null)
     {
         throw new ArgumentNullException("Declaring Type");
     }
     if (codeDomEvent == null)
     {
         throw new ArgumentNullException("codeDomEvent");
     }
     this.declaringType = declaringType;
     this.codeDomEvent = codeDomEvent;
     this.name = Helper.EnsureTypeName(codeDomEvent.Name);
     this.memberAttributes = codeDomEvent.Attributes;
     this.addMethod = null;
     this.removeMethod = null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:DesignTimeEventInfo.cs


示例7: Compile

        public System.CodeDom.CodeTypeMember Compile()
        {
            CodeMemberEvent memberEvent = new CodeMemberEvent();
            memberEvent.Type = new CodeTypeReference(type.Target);
            memberEvent.Name = name;
            memberEvent.Attributes = memberAttribute;

            for( int pos = 0; pos < comments.Count; pos++ ) {
                //  TODO loop in comments.Count
                memberEvent.Comments.Add(new CodeCommentStatement(comments[pos]));
            }
            for( int pos = 0; pos < attributes.Count; pos++ ) {
                //  TODO loop in attributes
                memberEvent.CustomAttributes.Add(new CodeAttributeDeclaration(attributes[pos].name));
            }
            return memberEvent;
        }
开发者ID:wuxingogo,项目名称:WuxingogoExtension,代码行数:17,代码来源:XCodeEvent.cs


示例8: AddPropertyChanging

        public static void AddPropertyChanging(CodeTypeDeclaration declaration)
        {
            CodeMemberEvent changingEvent = new CodeMemberEvent();
            changingEvent.Name = "PropertyChanging";
            changingEvent.Type = new CodeTypeReference(typeof(PropertyChangingEventHandler));
            changingEvent.Attributes = MemberAttributes.Public;

            declaration.Members.Add(changingEvent);

            CodeMemberMethod changingMethod = new CodeMemberMethod();
            changingMethod.Name = "OnPropertyChanging";
            changingMethod.ReturnType = new CodeTypeReference(typeof(void));
            changingMethod.Attributes = MemberAttributes.Family;
            changingMethod.Parameters.Add(new CodeParameterDeclarationExpression(typeof(string), "propertyName"));
            changingMethod.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(DebuggerNonUserCodeAttribute))));

            changingMethod.Statements.Add(new CodeConditionStatement(
                    new CodeBinaryOperatorExpression(
                        new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "PropertyChanging"),
                        CodeBinaryOperatorType.IdentityInequality,
                        new CodePrimitiveExpression(null)
                    ),
                    new CodeStatement[] {
                        new CodeExpressionStatement(
                            new CodeMethodInvokeExpression(
                                new CodeThisReferenceExpression(),
                                "PropertyChanging",
                                new CodeExpression[] {
                                    new CodeThisReferenceExpression(),
                                    new CodeObjectCreateExpression(
                                        typeof(PropertyChangingEventArgs),
                                        new CodeExpression[] {
                                            new CodeArgumentReferenceExpression("propertyName")
                                        }
                                    )
                                }
                            )
                        )
                    }
                ));

            declaration.Members.Add(changingMethod);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:43,代码来源:EntityCodeGeneratorHelper.cs


示例9: CreateEventDefinition

        public static CodeTypeMember CreateEventDefinition(
            this INamedTypeSymbol typeToWrap,
            WrapsAttrNameChangeView eventNameChangeView, 
            IList<string> namespaces    
        )
        {
            IEventSymbol wrappedEventInfo =
                typeToWrap.GetMembers(eventNameChangeView.Name).FirstOrDefault() as IEventSymbol;

            ITypeSymbol eventTypeSymbol = wrappedEventInfo.Type;

            CodeTypeReference eventTypeReference = eventTypeSymbol.GetTypeReference(namespaces);

            CodeMemberEvent codeEvent = new CodeMemberEvent
            {
                Name = eventNameChangeView.WrapperName,
                Type = eventTypeReference,
                Attributes = wrappedEventInfo.GetFlags(eventNameChangeView.TheEncapsulationLevel)
            };

            return codeEvent;
        }
开发者ID:,项目名称:,代码行数:22,代码来源:


示例10: Emit

        // Builds a codedom event and attaches it to the given type.
        // It seems that there is a codedom bug: you can't make events static.
        public static void Emit(CodeTypeDeclaration codeType, Event e)
        {
            // Create the codedom event and attach to the codedom type.
            var codeEvent = new CodeMemberEvent();
            codeType.Members.Add(codeEvent);

            // Assign a name
            codeEvent.Name = e.Name;

            // Assign the type.
            codeEvent.Type = new CodeTypeReference(e.DelegateName);

            // Translate the accessibility
            MemberAttributes memberAttributes = MemberAttributes.Public;
            switch (e.Accessibility)
            {
                case Accessibility.Internal:
                    memberAttributes = MemberAttributes.FamilyAndAssembly;
                    break;
                case Accessibility.Private:
                    memberAttributes = MemberAttributes.Private;
                    break;
                case Accessibility.Protected:
                    memberAttributes = MemberAttributes.Family;
                    break;
                case Accessibility.Public:
                    memberAttributes = MemberAttributes.Public;
                    break;
            }

            // This is bugged in codedom: no effect.
            if (e.IsShared)
                memberAttributes |= MemberAttributes.Static;

            codeEvent.Attributes = memberAttributes;
        }
开发者ID:maleficus1234,项目名称:Pie,代码行数:38,代码来源:EventEmitter.cs


示例11: GenerateEvent

        static CodeTypeMember GenerateEvent(EventDefinition eventDefinition)
        {
            var @event = new CodeMemberEvent
            {
                Name = eventDefinition.Name,
                Attributes = MemberAttributes.Public | MemberAttributes.Final,
                CustomAttributes = CreateCustomAttributes(eventDefinition),
                Type = CreateCodeTypeReference(eventDefinition.EventType)
            };

            return @event;
        }
开发者ID:Particular,项目名称:ServiceControl.Plugin.Nsb6.CustomChecks,代码行数:12,代码来源:PublicApiGenerator.cs


示例12: GenerateEvent

        protected override void GenerateEvent(CodeMemberEvent e, CodeTypeDeclaration c) {
            if (IsCurrentDelegate || IsCurrentEnum) return;

            if (e.CustomAttributes.Count > 0) {
                GenerateAttributes(e.CustomAttributes);
            }

            if (e.PrivateImplementationType == null) {
                OutputMemberAccessModifier(e.Attributes);
            }
            Output.Write("event ");
            string name = e.Name;
            if (e.PrivateImplementationType != null) {
                name = e.PrivateImplementationType.BaseType + "." + name;
            }
            OutputTypeNamePair(e.Type, name);
            Output.WriteLine(";");
        }
开发者ID:ArildF,项目名称:masters,代码行数:18,代码来源:csharpcodeprovider.cs


示例13: ValidateEvent

        private void ValidateEvent(CodeMemberEvent e) {

            if (e.CustomAttributes.Count > 0) {
                ValidateAttributes(e.CustomAttributes);
            }
            if (e.PrivateImplementationType != null) {
                ValidateTypeReference(e.Type);
                ValidateIdentifier(e,"Name",e.Name);
            }

            ValidateTypeReferences(e.ImplementationTypes);
        }
开发者ID:uQr,项目名称:referencesource,代码行数:12,代码来源:CodeValidator.cs


示例14: GenerateEvent

		protected override void GenerateEvent (CodeMemberEvent eventRef, CodeTypeDeclaration declaration)
		{
			if (IsCurrentDelegate || IsCurrentEnum) {
				return;
			}

			OutputAttributes (eventRef.CustomAttributes, null, false);

			if (eventRef.PrivateImplementationType == null) {
				OutputMemberAccessModifier (eventRef.Attributes);
			}

			Output.Write ("event ");

			if (eventRef.PrivateImplementationType != null) {
				OutputTypeNamePair (eventRef.Type,
					eventRef.PrivateImplementationType.BaseType + "." + 
					eventRef.Name);
			} else {
				OutputTypeNamePair (eventRef.Type, GetSafeName (eventRef.Name));
			}
			Output.WriteLine (';');
		}
开发者ID:runefs,项目名称:Marvin,代码行数:23,代码来源:CSharpCodeGenerator.cs


示例15: GenerateEvent

		protected override void GenerateEvent(CodeMemberEvent e, CodeTypeDeclaration c)
		{
			Output.WriteLine("[CodeMemberEvent: {0}]", e.ToString());
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:4,代码来源:CodeDOMVerboseOutputGenerator.cs


示例16: GenerateEvent

 protected override void GenerateEvent(CodeMemberEvent e, CodeTypeDeclaration c)
 {
     if (!base.IsCurrentDelegate && !base.IsCurrentEnum)
     {
         if (e.CustomAttributes.Count > 0)
         {
             this.OutputAttributes(e.CustomAttributes, false);
         }
         string name = e.Name;
         if (e.PrivateImplementationType != null)
         {
             string str2 = this.GetBaseTypeOutput(e.PrivateImplementationType).Replace('.', '_');
             e.Name = str2 + "_" + e.Name;
         }
         this.OutputMemberAccessModifier(e.Attributes);
         base.Output.Write("Event ");
         this.OutputTypeNamePair(e.Type, e.Name);
         if (e.ImplementationTypes.Count > 0)
         {
             base.Output.Write(" Implements ");
             bool flag = true;
             foreach (CodeTypeReference reference in e.ImplementationTypes)
             {
                 if (flag)
                 {
                     flag = false;
                 }
                 else
                 {
                     base.Output.Write(" , ");
                 }
                 this.OutputType(reference);
                 base.Output.Write(".");
                 this.OutputIdentifier(name);
             }
         }
         else if (e.PrivateImplementationType != null)
         {
             base.Output.Write(" Implements ");
             this.OutputType(e.PrivateImplementationType);
             base.Output.Write(".");
             this.OutputIdentifier(name);
         }
         base.Output.WriteLine("");
     }
 }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:46,代码来源:VBCodeGenerator.cs


示例17: GenerateEvent

		protected override void GenerateEvent (CodeMemberEvent eventRef, CodeTypeDeclaration declaration)
		{
			if (IsCurrentDelegate || IsCurrentEnum)
				return;

			TextWriter output = Output;

			OutputAttributes (eventRef.CustomAttributes, null,
				LineHandling.ContinueLine);

			OutputMemberAccessModifier (eventRef.Attributes);

			output.Write ("Event ");
			OutputTypeNamePair (eventRef.Type, GetEventName(eventRef));

			if (eventRef.ImplementationTypes.Count > 0) {
				OutputImplementationTypes (eventRef.ImplementationTypes, eventRef.Name);
			} else if (eventRef.PrivateImplementationType != null) {
				output.Write (" Implements ");
				OutputType (eventRef.PrivateImplementationType);
				output.Write ('.');
				output.Write (eventRef.Name);
			}

			output.WriteLine ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:26,代码来源:VBCodeGenerator.cs


示例18: GenerateEvent

		protected abstract void GenerateEvent (CodeMemberEvent ev, CodeTypeDeclaration d);
开发者ID:carrie901,项目名称:mono,代码行数:1,代码来源:CodeGenerator.cs


示例19: EnterEvent_

 public override void EnterEvent_([NotNull] XSharpParser.Event_Context context)
 {
     CodeMemberEvent evt = new CodeMemberEvent();
     evt.Name = context.Id.GetText();
     evt.Attributes = MemberAttributes.Public;
     evt.Type = new CodeTypeReference(context.Type.GetText());
     //
     if (context.Modifiers != null)
     {
         // Get standard Visibilities
         evt.Attributes = ContextToEventModifiers(context.Modifiers);
         if (context.Modifiers.NEW().Length > 0)
             evt.Attributes |= MemberAttributes.New;
         if (context.Modifiers.STATIC().Length > 0)
             evt.Attributes |= MemberAttributes.Static;
         if (context.Modifiers.VIRTUAL().Length > 0)
         {
             // According to MSDN, The absence of the Final flag makes a member virtual in C#, same for us
             evt.Attributes &= ~MemberAttributes.Final;
         }
         else
         {
             // Other cases = FINAL
             evt.Attributes |= MemberAttributes.Final;
         }
     }
     //
     this.CurrentClass.Members.Add(evt);
 }
开发者ID:X-Sharp,项目名称:XSharpPublic,代码行数:29,代码来源:XSharpTreeDiscover.cs


示例20: Visit

			public void Visit (CodeMemberEvent o)
			{
				g.GenerateEvent (o, g.CurrentClass);
			}
开发者ID:carrie901,项目名称:mono,代码行数:4,代码来源:CodeGenerator.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CodeDom.CodeMemberField类代码示例发布时间:2022-05-26
下一篇:
C# CodeDom.CodeLinePragma类代码示例发布时间: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