本文整理匯總了C#中Mono.CSharp.Modifiers.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Modifiers.ToString方法的具體用法?C# Modifiers.ToString怎麽用?C# Modifiers.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mono.CSharp.Modifiers
的用法示例。
在下文中一共展示了Modifiers.ToString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}