本文整理汇总了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;
}
示例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;
}