本文整理汇总了C#中Modifiers.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Modifiers.ToString方法的具体用法?C# Modifiers.ToString怎么用?C# Modifiers.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modifiers
的用法示例。
在下文中一共展示了Modifiers.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AccessibilityName
public static string AccessibilityName (Modifiers mod)
{
switch (mod & Modifiers.AccessibilityMask) {
case Modifiers.PUBLIC:
return "public";
case Modifiers.PROTECTED:
return "protected";
case Modifiers.PROTECTED | Modifiers.INTERNAL:
return "protected internal";
case Modifiers.INTERNAL:
return "internal";
case Modifiers.PRIVATE:
return "private";
default:
throw new NotImplementedException (mod.ToString ());
}
}
示例2: MethodAttr
public static MethodAttributes MethodAttr (Modifiers mod_flags)
{
MethodAttributes ma = MethodAttributes.HideBySig;
switch (mod_flags & Modifiers.AccessibilityMask) {
case Modifiers.PUBLIC:
ma |= MethodAttributes.Public;
break;
case Modifiers.PRIVATE:
ma |= MethodAttributes.Private;
break;
case Modifiers.PROTECTED | Modifiers.INTERNAL:
ma |= MethodAttributes.FamORAssem;
break;
case Modifiers.PROTECTED:
ma |= MethodAttributes.Family;
break;
case Modifiers.INTERNAL:
ma |= MethodAttributes.Assembly;
break;
default:
throw new NotImplementedException (mod_flags.ToString ());
}
if ((mod_flags & Modifiers.STATIC) != 0)
ma |= MethodAttributes.Static;
if ((mod_flags & Modifiers.ABSTRACT) != 0) {
ma |= MethodAttributes.Abstract | MethodAttributes.Virtual;
}
if ((mod_flags & Modifiers.SEALED) != 0)
ma |= MethodAttributes.Final;
if ((mod_flags & Modifiers.VIRTUAL) != 0)
ma |= MethodAttributes.Virtual;
if ((mod_flags & Modifiers.OVERRIDE) != 0) {
ma |= MethodAttributes.Virtual;
} else {
if ((ma & MethodAttributes.Virtual) != 0)
ma |= MethodAttributes.NewSlot;
}
return ma;
}
示例3: ExpressoModifierToken
public ExpressoModifierToken(TextLocation loc, Modifiers modifier)
: base(loc, new TokenRole(modifier.ToString().ToLower(), ExpressoTokenNode.Null))
{
this.modifier = modifier;
}