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


C# EntityDeclaration.HasModifier方法代码示例

本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.EntityDeclaration.HasModifier方法的典型用法代码示例。如果您正苦于以下问题:C# EntityDeclaration.HasModifier方法的具体用法?C# EntityDeclaration.HasModifier怎么用?C# EntityDeclaration.HasModifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.NRefactory.CSharp.EntityDeclaration的用法示例。


在下文中一共展示了EntityDeclaration.HasModifier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAccessibility

		static bool GetAccessibility (EntityDeclaration element, out Accessibility acc)
		{
			if (element.Parent is TypeDeclaration && ((TypeDeclaration)element.Parent).ClassType == ClassType.Interface) {
				acc = Accessibility.Public;
				return true;
			}
			bool result = false;
			acc = Accessibility.Private;
			if (element is TypeDeclaration && !(element.Parent is TypeDeclaration))
				acc = Accessibility.Internal;
			if (element.HasModifier (Modifiers.Public)) {
				acc = Accessibility.Public;
				result = true;
			} else if (element.HasModifier (Modifiers.Private)) {
				acc = Accessibility.Private;
				result = true;
			} else if (element.HasModifier (Modifiers.Protected | Modifiers.Internal)) {
				acc = Accessibility.ProtectedOrInternal;
				result = true;
			} else if (element.HasModifier (Modifiers.Protected)) {
				acc = Accessibility.Protected;
				result = true;
			} else if (element.HasModifier (Modifiers.Internal)) {
				acc = Accessibility.Internal;
				result = true;
			} 
			return result;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:28,代码来源:AstStockIcons.cs

示例2: GetCodeMemberCategory

			GeneratedCodeMember GetCodeMemberCategory(EntityDeclaration x)
			{
				bool isStatic = x.HasModifier(Modifiers.Static) || x.HasModifier(Modifiers.Const);
				if (x is FieldDeclaration)
					return isStatic ? GeneratedCodeMember.StaticFields : GeneratedCodeMember.InstanceFields;
				if (x is IndexerDeclaration)
					return GeneratedCodeMember.Indexer;
				if (x is PropertyDeclaration)
					return isStatic ? GeneratedCodeMember.StaticProperties : GeneratedCodeMember.InstanceProperties;
				if (x is ConstructorDeclaration || x is DestructorDeclaration)
					return GeneratedCodeMember.Constructors;
				if (x is MethodDeclaration)
					return isStatic ? GeneratedCodeMember.StaticMethods : GeneratedCodeMember.InstanceMethods;
				if (x is OperatorDeclaration)
					return GeneratedCodeMember.Operators;
				if (x is EventDeclaration)
					return isStatic ? GeneratedCodeMember.StaticEvents : GeneratedCodeMember.InstanceEvents;

				if (x is TypeDeclaration)
					return GeneratedCodeMember.NestedTypes;

				return GeneratedCodeMember.Unknown;
			}
开发者ID:awatertree,项目名称:NRefactory,代码行数:23,代码来源:GeneratedCodeSettings.cs


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