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

C# EventDeclaration类代码示例

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

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



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

示例1: EmitEventAccessor

        protected void EmitEventAccessor(EventDeclaration e, VariableInitializer evtVar, bool add)
        {
            string name = evtVar.Name;

            this.Write(add ? "add" : "remove", name, " : ");
            this.WriteFunction();
            this.WriteOpenParentheses();
            this.Write("value");
            this.WriteCloseParentheses();
            this.WriteSpace();
            this.BeginBlock();
            this.WriteThis();
            this.WriteDot();
            this.Write(this.Emitter.GetEntityName(e));
            this.Write(" = ");
            this.Write(Bridge.Translator.Emitter.ROOT, ".", add ? Bridge.Translator.Emitter.DELEGATE_COMBINE : Bridge.Translator.Emitter.DELEGATE_REMOVE);
            this.WriteOpenParentheses();
            this.WriteThis();
            this.WriteDot();
            this.Write(this.Emitter.GetEntityName(e));
            this.WriteComma();
            this.WriteSpace();
            this.Write("value");
            this.WriteCloseParentheses();
            this.WriteSemiColon();
            this.WriteNewLine();
            this.EndBlock();
        }
开发者ID:Cestbienmoi,项目名称:Bridge,代码行数:28,代码来源:MethodBlock.cs


示例2: AddRange

		/// <summary>
		/// Adds the elements of an array to the end of this EventDeclarationCollection.
		/// </summary>
		/// <param name="items">
		/// The array whose elements are to be added to the end of this EventDeclarationCollection.
		/// </param>
		public virtual void AddRange(EventDeclaration[] items)
		{
			foreach (EventDeclaration item in items)
			{
				this.List.Add(item);
			}
		}
开发者ID:uQr,项目名称:NHibernate.Mapping.Attributes,代码行数:13,代码来源:EventDeclarationCollection.cs


示例3: EventReferenceExpression

        public EventReferenceExpression(Expression target,EventDeclaration _event)
        {
            if (target==null)
                throw new ArgumentNullException("target");
            if (_event==null)
                throw new ArgumentNullException("_event");

            this.target = target;
            this.declaringEvent = _event;
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:10,代码来源:EventReferenceExpression.cs


示例4: Create

        public static OverloadsCollection Create(IEmitter emitter, EventDeclaration eventDeclaration)
        {
            string key = eventDeclaration.GetHashCode().ToString();
            if (emitter.OverloadsCache.ContainsKey(key))
            {
                return emitter.OverloadsCache[key];
            }

            return new OverloadsCollection(emitter, eventDeclaration);
        }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:10,代码来源:OverloadsCollection.cs


示例5: CreateEventInvocator

		public static MethodDeclaration CreateEventInvocator (RefactoringContext context, TypeDeclaration declaringType, EventDeclaration eventDeclaration, VariableInitializer initializer, IMethod invokeMethod, bool useExplictType)
		{
			bool hasSenderParam = false;
			IEnumerable<IParameter> pars = invokeMethod.Parameters;
			if (invokeMethod.Parameters.Any()) {
				var first = invokeMethod.Parameters [0];
				if (first.Name == "sender" /*&& first.Type == "System.Object"*/) {
					hasSenderParam = true;
					pars = invokeMethod.Parameters.Skip(1);
				}
			}
			const string handlerName = "handler";

			var arguments = new List<Expression>();
			if (hasSenderParam)
				arguments.Add(eventDeclaration.HasModifier (Modifiers.Static) ? (Expression)new PrimitiveExpression (null) : new ThisReferenceExpression());
			bool useThisMemberReference = false;
			foreach (var par in pars) {
				arguments.Add(new IdentifierExpression(par.Name));
				useThisMemberReference |= par.Name == initializer.Name;
			}
			var proposedHandlerName = GetNameProposal(initializer);
			var modifiers = eventDeclaration.HasModifier(Modifiers.Static) ? Modifiers.Static : Modifiers.Protected | Modifiers.Virtual;
			if (declaringType.HasModifier (Modifiers.Sealed)) {
				modifiers = Modifiers.None;
			}
			var methodDeclaration = new MethodDeclaration {
				Name = proposedHandlerName,
				ReturnType = new PrimitiveType ("void"),
				Modifiers = modifiers,
				Body = new BlockStatement {
					new VariableDeclarationStatement (
						useExplictType ? eventDeclaration.ReturnType.Clone () : new PrimitiveType ("var"), handlerName, 
						useThisMemberReference ? 
						(Expression)new MemberReferenceExpression (new ThisReferenceExpression (), initializer.Name) 
						: new IdentifierExpression (initializer.Name)
						),
					new IfElseStatement {
						Condition = new BinaryOperatorExpression (new IdentifierExpression (handlerName), BinaryOperatorType.InEquality, new PrimitiveExpression (null)),
						TrueStatement = new InvocationExpression (new IdentifierExpression (handlerName), arguments)
					}
				}
			};

			foreach (var par in pars) {
				var typeName = context.CreateShortType(par.Type);
				var decl = new ParameterDeclaration(typeName, par.Name);
				methodDeclaration.Parameters.Add(decl);
			}
			return methodDeclaration;
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:51,代码来源:CreateEventInvocatorAction.cs


示例6: OverloadsCollection

 private OverloadsCollection(IEmitter emitter, EventDeclaration eventDeclaration)
 {
     this.Emitter = emitter;
     this.Name = emitter.GetEventName(eventDeclaration);
     this.JsName = this.Emitter.GetEntityName(eventDeclaration, false, true);
     this.Inherit = !eventDeclaration.HasModifier(Modifiers.Static);
     this.Static = eventDeclaration.HasModifier(Modifiers.Static);
     this.CancelChangeCase = true;
     this.Member = this.FindMember(eventDeclaration);
     this.TypeDefinition = this.Member.DeclaringTypeDefinition;
     this.Type = this.Member.DeclaringType;
     this.InitMembers();
     this.Emitter.OverloadsCache[eventDeclaration.GetHashCode().ToString()] = this;
 }
开发者ID:GavinHwa,项目名称:Bridge,代码行数:14,代码来源:OverloadsCollection.cs


示例7: VisitEventDeclaration

		public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
		{
			if (!eventDeclaration.HasAddRegion && !eventDeclaration.HasRaiseRegion && !eventDeclaration.HasRemoveRegion) {
				if (eventDeclaration.TypeReference.IsNull) {
					DelegateDeclaration dd = new DelegateDeclaration(eventDeclaration.Modifier, null);
					dd.Name = eventDeclaration.Name + "EventHandler";
					dd.Parameters = eventDeclaration.Parameters;
					dd.ReturnType = new TypeReference("System.Void", true);
					dd.Parent = eventDeclaration.Parent;
					eventDeclaration.Parameters = null;
					InsertAfterSibling(eventDeclaration, dd);
					eventDeclaration.TypeReference = new TypeReference(dd.Name);
				}
			}
			return base.VisitEventDeclaration(eventDeclaration, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:16,代码来源:ToCSharpConvertVisitor.cs


示例8: IntroduceEvent

 protected void IntroduceEvent(TransformationContext context, TypeDefDeclaration type, EventDeclaration theEvent)
 {
     var fieldRef = type.FindField(theEvent.Name);
     FieldDefDeclaration field;
     if(fieldRef == null) {
         field = new FieldDefDeclaration {
             Attributes = FieldAttributes.Private,
             Name = theEvent.Name,
             FieldType = theEvent.EventType,
         };
         type.Fields.Add(field);
     } else {
         field = fieldRef.Field;
     }
     var addOn = theEvent.GetAccessor(MethodSemantics.AddOn);
     if (addOn == null) {
         theEvent.ImplementAddOn(type, field, AspectInfrastructureTask.WeavingHelper);
     }
     var removeOn = theEvent.GetAccessor(MethodSemantics.RemoveOn);
     if (removeOn == null) {
         theEvent.ImplementRemoveOn(type, field, AspectInfrastructureTask.WeavingHelper);
     }
 }
开发者ID:DamianReeves,项目名称:PostEdge,代码行数:23,代码来源:MemberIntroductionTransformation.cs


示例9: GetEventName

        public virtual string GetEventName(EventDeclaration evt)
        {
            if (!string.IsNullOrEmpty(evt.Name))
            {
                return evt.Name;
            }

            if (evt.Variables.Count > 0)
            {
                return evt.Variables.First().Name;
            }

            return null;
        }
开发者ID:Cestbienmoi,项目名称:Bridge,代码行数:14,代码来源:Emitter.Helpers.cs


示例10: ConvertEvent

 EntityDeclaration ConvertEvent(IEvent ev)
 {
     if (this.UseCustomEvents) {
         CustomEventDeclaration decl = new CustomEventDeclaration();
         decl.Modifiers = GetMemberModifiers(ev);
         decl.ReturnType = ConvertType(ev.ReturnType);
         decl.Name = ev.Name;
         decl.AddAccessor    = ConvertAccessor(ev.AddAccessor, ev.Accessibility);
         decl.RemoveAccessor = ConvertAccessor(ev.RemoveAccessor, ev.Accessibility);
         return decl;
     } else {
         EventDeclaration decl = new EventDeclaration();
         decl.Modifiers = GetMemberModifiers(ev);
         decl.ReturnType = ConvertType(ev.ReturnType);
         decl.Variables.Add(new VariableInitializer(ev.Name));
         return decl;
     }
 }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:18,代码来源:TypeSystemAstBuilder.cs


示例11: VisitEventDeclaration

        public override void VisitEventDeclaration(EventDeclaration eventDeclaration)
        {
            FixAttributesAndDocComment(eventDeclaration);

            foreach (var m in eventDeclaration.ModifierTokens) {
                ForceSpacesAfter(m, true);
            }

            ForceSpacesBeforeRemoveNewLines(eventDeclaration.EventToken.GetNextSibling(NoWhitespacePredicate), true);
            eventDeclaration.ReturnType.AcceptVisitor(this);
            ForceSpacesAfter(eventDeclaration.ReturnType, true);
            /*
            var lastLoc = eventDeclaration.StartLocation;
            curIndent.Push(IndentType.Block);
            foreach (var initializer in eventDeclaration.Variables) {
                if (lastLoc.Line != initializer.StartLocation.Line) {
                    FixStatementIndentation(initializer.StartLocation);
                    lastLoc = initializer.StartLocation;
                }
                initializer.AcceptVisitor(this);
            }
            curIndent.Pop ();
            */
            FixSemicolon(eventDeclaration.SemicolonToken);
        }
开发者ID:porcus,项目名称:NRefactory,代码行数:25,代码来源:FormattingVisitor_TypeMembers.cs


示例12: CompileAndAddAutoEventMethodsToType

 private void CompileAndAddAutoEventMethodsToType(JsClass jsClass, EventDeclaration node, IEvent evt, EventScriptSemantics options, string backingFieldName)
 {
     if (options.AddMethod != null && options.AddMethod.GenerateCode) {
         var compiled = CreateMethodCompiler().CompileAutoEventAdder(evt, options, backingFieldName);
         AddCompiledMethodToType(jsClass, evt.AddAccessor, options.AddMethod, new JsMethod(evt.AddAccessor, options.AddMethod.Name, new string[0], compiled));
     }
     if (options.RemoveMethod != null && options.RemoveMethod.GenerateCode) {
         var compiled = CreateMethodCompiler().CompileAutoEventRemover(evt, options, backingFieldName);
         AddCompiledMethodToType(jsClass, evt.RemoveAccessor, options.RemoveMethod, new JsMethod(evt.RemoveAccessor, options.RemoveMethod.Name, new string[0], compiled));
     }
 }
开发者ID:jack128,项目名称:SaltarelleCompiler,代码行数:11,代码来源:Compiler.cs


示例13: Visit

			public override void Visit (EventProperty ep)
			{
				EventDeclaration newEvent = new EventDeclaration ();
				
				var location = LocationsBag.GetMemberLocation (ep);
				AddModifiers (newEvent, location);
				
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
				newEvent.AddChild ((INode)ep.TypeName.Accept (this), EventDeclaration.Roles.ReturnType);
				newEvent.AddChild (new Identifier (ep.MemberName.Name, Convert (ep.MemberName.Location)), EventDeclaration.Roles.Identifier);
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), 1), EventDeclaration.Roles.LBrace);
				
				if (ep.Add != null) {
					MonoDevelop.CSharp.Dom.Accessor addAccessor = new MonoDevelop.CSharp.Dom.Accessor ();
					var addLocation = LocationsBag.GetMemberLocation (ep.Add);
					AddModifiers (addAccessor, addLocation);
					addAccessor.AddChild (new CSharpTokenNode (Convert (ep.Add.Location), "add".Length), EventDeclaration.Roles.Keyword);
					if (ep.Add.Block != null)
						addAccessor.AddChild ((INode)ep.Add.Block.Accept (this), EventDeclaration.Roles.Body);
					newEvent.AddChild (addAccessor, EventDeclaration.EventAddRole);
				}
				
				if (ep.Remove != null) {
					MonoDevelop.CSharp.Dom.Accessor removeAccessor = new MonoDevelop.CSharp.Dom.Accessor ();
					var removeLocation = LocationsBag.GetMemberLocation (ep.Remove);
					AddModifiers (removeAccessor, removeLocation);
					removeAccessor.AddChild (new CSharpTokenNode (Convert (ep.Remove.Location), "remove".Length), EventDeclaration.Roles.Keyword);
					
					if (ep.Remove.Block != null)
						removeAccessor.AddChild ((INode)ep.Remove.Block.Accept (this), EventDeclaration.Roles.Body);
					newEvent.AddChild (removeAccessor, EventDeclaration.EventRemoveRole);
				}
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[2]), 1), EventDeclaration.Roles.RBrace);
				
				typeStack.Peek ().AddChild (newEvent, TypeDeclaration.Roles.Member);
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:39,代码来源:CSharpParser.cs


示例14: CSharpGrammar


//.........这里部分代码省略.........
                    var result = new MethodDeclaration();

                    if (node.Children[0].HasChildren)
                        result.CustomAttributeSections.AddRange(node.Children[0].Children[0].GetAllListAstNodes<CustomAttributeSection>());

                    if (node.Children[1].HasChildren)
                        result.ModifierElements.AddRange(node.Children[1].Children[0].GetAllListAstNodes<ModifierElement>());

                    result.ReturnType = (TypeReference) node.Children[2].Result;
                    result.Identifier = ToIdentifier(node.Children[3].Result);
                    result.LeftParenthese = (AstToken) node.Children[4].Result;

                    if (node.Children[5].HasChildren)
                    {
                        foreach (var subNode in node.Children[5].Children[0].GetAllListAstNodes())
                        {
                            if (subNode is AstToken)
                                result.AddChild(AstNodeTitles.ElementSeparator, subNode);
                            else
                                result.Parameters.Add((ParameterDeclaration) subNode);
                        }
                    }

                    result.RightParenthese = (AstToken) node.Children[6].Result;

                    var body = node.Children[7].Result;
                    if (body is AstToken)
                        result.AddChild(AstNodeTitles.Semicolon, (AstToken) body);
                    else
                        result.Body = (BlockStatement) body;
                    return result;
                });

            var eventDeclaration = new GrammarDefinition("EventDeclaration",
                rule: customAttributeSectionListOptional
                      + modifierListOptional
                      + ToElement(EVENT)
                      + typeReference
                      + variableDeclaratorList
                      + ToElement(SEMICOLON),
                createNode: node =>
                {
                    var result = new EventDeclaration();

                    if (node.Children[0].HasChildren)
                        result.CustomAttributeSections.AddRange(node.Children[0].Children[0].GetAllListAstNodes<CustomAttributeSection>());

                    if (node.Children[1].HasChildren)
                        result.ModifierElements.AddRange(node.Children[1].Children[0].GetAllListAstNodes<ModifierElement>());

                    result.EventKeyword = (AstToken) node.Children[2].Result;
                    result.EventType = (TypeReference) node.Children[3].Result;

                    foreach (var subNode in node.Children[4].GetAllListAstNodes())
                    {
                        if (subNode is AstToken)
                            result.AddChild(AstNodeTitles.ElementSeparator, subNode);
                        else
                            result.Declarators.Add((VariableDeclarator) subNode);
                    }

                    result.AddChild(AstNodeTitles.Semicolon, node.Children[5].Result);
                    return result;
                });

            var accessorKeyword = new GrammarDefinition("AccessorKeyword",
开发者ID:JerreS,项目名称:AbstractCode,代码行数:67,代码来源:CSharpGrammar.cs


示例15: GenerateCode

		protected override string GenerateCode(ITypeDefinition currentClass)
		{
			bool implementInterface = this.implementInterface.IsChecked == true;
			bool hasOnPropertyChanged = HasOnPropertyChanged(currentClass);
			bool useEventArgs = false;
			
			AstNode insertionAnchorElement = refactoringContext.GetNode();
			if ((insertionAnchorElement == null) || !(insertionAnchorElement.Parent is TypeDeclaration)) {
				return null;
			}
			NewLineNode newLineNode = insertionAnchorElement as NewLineNode;
			while (insertionAnchorElement.PrevSibling is NewLineNode)
				insertionAnchorElement = insertionAnchorElement.PrevSibling ?? insertionAnchorElement;
			
			using (Script script = refactoringContext.StartScript()) {
				TypeDeclaration currentClassDeclaration = insertionAnchorElement.Parent as TypeDeclaration;
				
				if (implementInterface && !currentClass.IsStatic) {
					if (!hasOnPropertyChanged) {
						var nodes = new List<AstNode>();
						if (!currentClass.GetAllBaseTypeDefinitions().Any(bt => bt.FullName == "System.ComponentModel.INotifyPropertyChanged")) {
							AstNode nodeBeforeClassBlock = currentClassDeclaration.LBraceToken;
							if (nodeBeforeClassBlock.PrevSibling is NewLineNode) {
								// There's a new line before the brace, insert before it!
								nodeBeforeClassBlock = nodeBeforeClassBlock.PrevSibling;
							}
							int insertion = editor.Document.GetOffset(nodeBeforeClassBlock.StartLocation);
							
							AstType interfaceTypeNode = refactoringContext.CreateShortType("System.ComponentModel", "INotifyPropertyChanged", 0);
							var directBaseTypes = currentClass.DirectBaseTypes.Where(t => t.FullName != "System.Object");
							if (currentClassDeclaration.BaseTypes.Count > 0) {
								script.InsertText(insertion, ", " + interfaceTypeNode + " ");
							} else {
								script.InsertText(insertion, " : " + interfaceTypeNode + " ");
							}
						}

						var rt = new GetClassTypeReference("System.ComponentModel", "INotifyPropertyChanged", 0);
						var rtResolved = rt.Resolve(refactoringContext.Compilation);
						var ev = rtResolved.GetEvents().First(e => e.Name == "PropertyChanged");
						
						EventDeclaration propertyChangedEvent = new EventDeclaration();
						propertyChangedEvent.Variables.Add(new VariableInitializer(ev.Name));
						propertyChangedEvent.Modifiers = Modifiers.Public;
						propertyChangedEvent.ReturnType = refactoringContext.CreateShortType(ev.ReturnType);
						
						nodes.Add(propertyChangedEvent);
						
						MethodDeclaration onEvent = CreateOnEventMethod(ev, currentClass);
						nodes.Add(onEvent);
						foreach (var node in nodes) {
							script.InsertAfter(insertionAnchorElement, node);
							AppendNewLine(script, insertionAnchorElement, newLineNode);
						}
						useEventArgs = false;
					} else {
						useEventArgs = currentClass.GetMethods().First(m => m.Name == "OnPropertyChanged").Parameters[0].Type.FullName != "System.String";
					}
				}
				
				foreach (FieldWrapper field in fields.Where(f => f.IsIncluded)) {
					var prop = CreateProperty(field.Field, true, field.AddSetter);
					if (!field.Field.IsStatic && !currentClass.IsStatic && field.AddSetter && implementInterface) {
						var invocation = new ExpressionStatement(CreateInvocation(field.PropertyName, useEventArgs));
						var assignment = prop.Setter.Body.Children.ElementAt(0) as Statement;
						prop.Setter.Body = new BlockStatement();
						BlockStatement elseBlock = new BlockStatement();
						elseBlock.Add(assignment.Clone());
						elseBlock.Add(invocation);
						prop.Setter.Body.Add(
							new IfElseStatement(
								new BinaryOperatorExpression(new IdentifierExpression(field.MemberName), BinaryOperatorType.InEquality, new IdentifierExpression("value")),
								elseBlock
							)
						);
					}
					
					script.InsertAfter(insertionAnchorElement, prop);
					AppendNewLine(script, insertionAnchorElement, newLineNode);
				}
			}
			
			return null;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:84,代码来源:CreatePropertiesDialog.xaml.cs


示例16: Visit

 public override void Visit(EventDeclaration node) { this.action(node); }
开发者ID:yaakoviyun,项目名称:sqlskim,代码行数:1,代码来源:AllNodesVisitor.cs


示例17: AddImplementation

        static void AddImplementation(RefactoringContext context, TypeDeclaration result, IType guessedType)
        {
            foreach (var property in guessedType.GetProperties ()) {
                if (!property.IsAbstract)
                    continue;
                if (property.IsIndexer) {
                    var indexerDecl = new IndexerDeclaration {
                        ReturnType = context.CreateShortType(property.ReturnType),
                        Modifiers = GetModifiers(property),
                        Name = property.Name
                    };
                    indexerDecl.Parameters.AddRange(ConvertParameters(context, property.Parameters));
                    if (property.CanGet)
                        indexerDecl.Getter = new Accessor();
                    if (property.CanSet)
                        indexerDecl.Setter = new Accessor();
                    result.AddChild(indexerDecl, Roles.TypeMemberRole);
                    continue;
                }
                var propDecl = new PropertyDeclaration {
                    ReturnType = context.CreateShortType(property.ReturnType),
                    Modifiers = GetModifiers (property),
                    Name = property.Name
                };
                if (property.CanGet)
                    propDecl.Getter = new Accessor();
                if (property.CanSet)
                    propDecl.Setter = new Accessor();
                result.AddChild(propDecl, Roles.TypeMemberRole);
            }

            foreach (var method in guessedType.GetMethods ()) {
                if (!method.IsAbstract)
                    continue;
                var decl = new MethodDeclaration {
                    ReturnType = context.CreateShortType(method.ReturnType),
                    Modifiers = GetModifiers (method),
                    Name = method.Name,
                    Body = new BlockStatement {
                        new ThrowStatement(new ObjectCreateExpression(context.CreateShortType("System", "NotImplementedException")))
                    }
                };
                decl.Parameters.AddRange(ConvertParameters(context, method.Parameters));
                result.AddChild(decl, Roles.TypeMemberRole);
            }

            foreach (var evt in guessedType.GetEvents ()) {
                if (!evt.IsAbstract)
                    continue;
                var decl = new EventDeclaration {
                    ReturnType = context.CreateShortType(evt.ReturnType),
                    Modifiers = GetModifiers (evt),
                    Variables = {
                        new VariableInitializer {
                            Name = evt.Name
                        }
                    }
                };
                decl.Variables.Add(new VariableInitializer(evt.Name));
                result.AddChild(decl, Roles.TypeMemberRole);
            }
        }
开发者ID:CSRedRat,项目名称:NRefactory,代码行数:62,代码来源:CreateClassDeclarationAction.cs


示例18: EventTreeNode

 public EventTreeNode( EventDeclaration @event ) : base( @event, TreeViewImage.Event, @event.Visibility )
 {
     [email protected] = @event;
     this.Text = @event.Name + " : " + @event.EventType.ToString();
     this.EnableLatePopulate();
 }
开发者ID:jogibear9988,项目名称:ormbattle,代码行数:6,代码来源:EventTreeNode.cs


示例19: VisitEventDeclaration

        public void VisitEventDeclaration(EventDeclaration declaration)
        {
            Formatter.StartNode(declaration);

            if (declaration.CustomAttributeSections.Count > 0)
            {
                WriteNodes(declaration.CustomAttributeSections, true);
                Formatter.WriteLine();
            }

            if (declaration.ModifierElements.Count > 0)
            {
                WriteSpaceSeparatedNodes(declaration.ModifierElements);
                Formatter.WriteSpace();
            }

            Formatter.WriteKeyword("event");
            Formatter.WriteSpace();
            declaration.EventType.AcceptVisitor(this);
            Formatter.WriteSpace();
            WriteCommaSeparatedNodes(declaration.Declarators);

            if (declaration.AddAccessor == null && declaration.RemoveAccessor == null)
            {
                WriteSemicolon();
            }
            else
            {
                Formatter.OpenBrace(Parameters.EventBraceStyle);

                declaration.AddAccessor.AcceptVisitor(this);
                declaration.RemoveAccessor.AcceptVisitor(this);

                Formatter.CloseBrace(Parameters.EventBraceStyle);
            }

            Formatter.EndNode();
        }
开发者ID:JerreS,项目名称:AbstractCode,代码行数:38,代码来源:CSharpAstWriter.cs


示例20: EventDeclarationBlock

 public EventDeclarationBlock(IEmitter emitter, EventDeclaration eventDeclaration)
     : base(emitter, eventDeclaration)
 {
     this.Emitter = emitter;
     this.EventDeclaration = eventDeclaration;
 }
开发者ID:txdv,项目名称:Builder,代码行数:6,代码来源:EventDeclarationBlock.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# EventDelegate类代码示例发布时间:2022-05-24
下一篇:
C# EventData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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