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

C# CSharp.EventField类代码示例

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

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



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

示例1: Visit

			public override void Visit (EventField e)
			{
				EventDeclaration newEvent = new EventDeclaration ();
				
				var location = LocationsBag.GetMemberLocation (e);
				AddModifiers (newEvent, location);
				
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
				newEvent.AddChild ((INode)e.TypeName.Accept (this), AbstractNode.Roles.ReturnType);
				newEvent.AddChild (new Identifier (e.MemberName.Name, Convert (e.MemberName.Location)), EventDeclaration.Roles.Identifier);
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), EventDeclaration.Roles.Semicolon);
				
				typeStack.Peek ().AddChild (newEvent, TypeDeclaration.Roles.Member);
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:16,代码来源:CSharpParser.cs


示例2: Define

		public override bool Define()
		{
			var mod_flags_src = ModFlags;

			if (!base.Define ())
				return false;

			if (declarators != null) {
				if ((mod_flags_src & Modifiers.DEFAULT_ACCESS_MODIFER) != 0)
					mod_flags_src &= ~(Modifiers.AccessibilityMask | Modifiers.DEFAULT_ACCESS_MODIFER);

				var t = new TypeExpression (MemberType, TypeExpression.Location);
				foreach (var d in declarators) {
					var ef = new EventField (Parent, t, mod_flags_src, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);

					if (d.Initializer != null)
						ef.initializer = d.Initializer;

					ef.Define ();
					Parent.PartialContainer.Members.Add (ef);
				}
			}

			if (!HasBackingField) {
				SetIsUsed ();
				return true;
			}

			if (Add.IsInterfaceImplementation)
				SetIsUsed ();

			backing_field = new Field (Parent,
				new TypeExpression (MemberType, Location),
				Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
				MemberName, null);

			Parent.PartialContainer.Members.Add (backing_field);
			backing_field.Initializer = Initializer;
			backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;

			// Call define because we passed fields definition
			backing_field.Define ();

			// Set backing field for event fields
			spec.BackingField = backing_field.Spec;

			return true;
		}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:48,代码来源:property.cs


示例3: EventFieldAccessor

			protected EventFieldAccessor (EventField method, string prefix)
				: base (method, prefix, null, method.Location)
			{
			}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:4,代码来源:property.cs


示例4: AddDelegateMethod

			public AddDelegateMethod (EventField method):
				base (method, AddPrefix)
			{
			}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:4,代码来源:property.cs


示例5: RemoveDelegateMethod

			public RemoveDelegateMethod (EventField method):
				base (method, RemovePrefix)
			{
			}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:4,代码来源:property.cs


示例6: Visit

			public override void Visit (EventField e)
			{
				var evt = new DomEvent ();
				evt.Name = ConvertQuoted (e.MemberName.Name);
				evt.Documentation = RetrieveDocumentation (e.Location.Row);
				evt.Location = Convert (e.MemberName.Location);
				evt.Modifiers = ConvertModifiers (e.ModFlags);
				evt.ReturnType = ConvertReturnType (e.TypeName);
				AddAttributes (evt, e.OptAttributes, e);
				AddExplicitInterfaces (evt, e);
				evt.DeclaringType = typeStack.Peek ();
				typeStack.Peek ().Add (evt);
				if (e.Declarators != null) {
					foreach (var decl in e.Declarators) {
						evt = new DomEvent ();
						evt.Name = ConvertQuoted (decl.Name.Value);
						evt.Location = Convert (decl.Name.Location);
						evt.Modifiers = ConvertModifiers (e.ModFlags);
						evt.ReturnType = ConvertReturnType (e.TypeName);
						AddAttributes (evt, e.OptAttributes, e);
						evt.DeclaringType = typeStack.Peek ();
						typeStack.Peek ().Add (evt);
					}
				}
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:25,代码来源:McsParser.cs


示例7: Visit

			public override void Visit(EventField e)
			{
				var newEvent = new EventDeclaration();
				AddAttributeSection(newEvent, e);
				var location = LocationsBag.GetMemberLocation(e);
				int l = 0;
				AddModifiers(newEvent, location);
				
				if (location != null && location.Count > 0)
					newEvent.AddChild(new CSharpTokenNode(Convert(location [l++]), EventDeclaration.EventKeywordRole), EventDeclaration.EventKeywordRole);
				newEvent.AddChild(ConvertToType(e.TypeExpression), Roles.Type);
				
				var variable = new VariableInitializer();
				variable.AddChild(Identifier.Create(e.MemberName.Name, Convert(e.MemberName.Location)), Roles.Identifier);
				
				if (e.Initializer != null) {
					if (location != null && location.Count > l)
						variable.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.Assign), Roles.Assign);
					variable.AddChild((Expression)e.Initializer.Accept(this), Roles.Expression);
				}
				newEvent.AddChild(variable, Roles.Variable);
				if (e.Declarators != null) {
					foreach (var decl in e.Declarators) {
						var declLoc = LocationsBag.GetLocations(decl);
						if (declLoc != null)
							newEvent.AddChild(new CSharpTokenNode(Convert(declLoc [0]), Roles.Comma), Roles.Comma);
						
						variable = new VariableInitializer();
						variable.AddChild(Identifier.Create(decl.Name.Value, Convert(decl.Name.Location)), Roles.Identifier);

						if (decl.Initializer != null) {
							if (declLoc != null)
								variable.AddChild(new CSharpTokenNode(Convert(declLoc [1]), Roles.Assign), Roles.Assign);
							variable.AddChild((Expression)decl.Initializer.Accept(this), Roles.Expression);
						}
						newEvent.AddChild(variable, Roles.Variable);
					}
				}
				
				if (location != null && location.Count > l)
					newEvent.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.Semicolon), Roles.Semicolon);
				
				typeStack.Peek().AddChild(newEvent, Roles.TypeMemberRole);
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:44,代码来源:CSharpParser.cs


示例8: Visit

			public override void Visit (EventField e)
			{
				EventDeclaration newEvent = new EventDeclaration ();
				AddAttributeSection (newEvent, e);
				var location = LocationsBag.GetMemberLocation (e);
				AddModifiers (newEvent, location);
				
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
				newEvent.AddChild (ConvertToType (e.TypeName), AstNode.Roles.Type);
				
				VariableInitializer variable = new VariableInitializer ();
				variable.AddChild (Identifier.Create (e.MemberName.Name, Convert (e.MemberName.Location)), FieldDeclaration.Roles.Identifier);
				
				if (e.Initializer != null) {
					if (location != null)
						variable.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FieldDeclaration.Roles.Assign);
					variable.AddChild ((Expression)e.Initializer.Accept (this), VariableInitializer.Roles.Expression);
				}
				newEvent.AddChild (variable, FieldDeclaration.Roles.Variable);
				if (e.Declarators != null) {
					foreach (var decl in e.Declarators) {
						var declLoc = LocationsBag.GetLocations (decl);
						if (declLoc != null)
							newEvent.AddChild (new CSharpTokenNode (Convert (declLoc [0]), 1), FieldDeclaration.Roles.Comma);
						
						variable = new VariableInitializer ();
						variable.AddChild (Identifier.Create (decl.Name.Value, Convert (decl.Name.Location)), VariableInitializer.Roles.Identifier);

						if (decl.Initializer != null) {
							if (declLoc != null)
								variable.AddChild (new CSharpTokenNode (Convert (declLoc [1]), 1), FieldDeclaration.Roles.Assign);
							variable.AddChild ((Expression)decl.Initializer.Accept (this), VariableInitializer.Roles.Expression);
						}
						newEvent.AddChild (variable, FieldDeclaration.Roles.Variable);
					}
				}
				
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), EventDeclaration.Roles.Semicolon);
				
				typeStack.Peek ().AddChild (newEvent, TypeDeclaration.MemberRole);
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:43,代码来源:CSharpParser.cs


示例9: Define

		public override bool Define()
		{
			if (!base.Define ())
				return false;

			if (declarators != null) {
				var t = new TypeExpression (MemberType, TypeExpression.Location);
				int index = Parent.PartialContainer.Events.IndexOf (this);
				foreach (var d in declarators) {
					var ef = new EventField (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);

					if (d.Initializer != null)
						ef.initializer = d.Initializer;

					Parent.PartialContainer.Events.Insert (++index, ef);
				}
			}

			if (!HasBackingField) {
				SetIsUsed ();
				return true;
			}

			if (Add.IsInterfaceImplementation)
				SetIsUsed ();

			backing_field = new Field (Parent,
				new TypeExpression (MemberType, Location),
				Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
				MemberName, null);

			Parent.PartialContainer.AddField (backing_field);
			backing_field.Initializer = Initializer;
			backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;

			// Call define because we passed fields definition
			backing_field.Define ();

			// Set backing field for event fields
			spec.BackingField = backing_field.Spec;

			return true;
		}
开发者ID:afaerber,项目名称:mono,代码行数:43,代码来源:property.cs


示例10: Visit

		public virtual void Visit (EventField e)
		{
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:3,代码来源:visit.cs


示例11: EventFieldAccessor

 protected EventFieldAccessor(EventField method, string prefix)
     : base(method, prefix)
 {
 }
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:property.cs


示例12: Visit

			public override void Visit (EventField e)
			{
				DomEvent evt = new DomEvent ();
				evt.Name = e.MemberName.Name;
				evt.Documentation = RetrieveDocumentation (e.Location.Row);
				evt.Location = Convert (e.MemberName.Location);
				evt.Modifiers = ConvertModifiers (e.ModFlags);
				evt.ReturnType = ConvertReturnType (e.TypeName);
				AddAttributes (evt, e.OptAttributes);
				AddExplicitInterfaces (evt, e);
				evt.DeclaringType = typeStack.Peek ();
				typeStack.Peek ().Add (evt);
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:13,代码来源:McsParser.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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