private static Tuple<AccessLevelEnumMetadata, AbstractEnumMetadata, StaticEnumMetadata, VirtualEnumMetadata, OverrideEnumMetadata> EmitModifiers(MethodBase method) { AccessLevelEnumMetadata _access = AccessLevelEnumMetadata.Private; if (method.IsPublic) _access = AccessLevelEnumMetadata.Public; else if (method.IsFamily) _access = AccessLevelEnumMetadata.Protected; else if (method.IsFamilyAndAssembly) _access = AccessLevelEnumMetadata.ProtectedInternal; AbstractEnumMetadata _abstract = AbstractEnumMetadata.NotAbstract; if (method.IsAbstract) _abstract = AbstractEnumMetadata.Abstract; StaticEnumMetadata _static = StaticEnumMetadata.NotStatic; if (method.IsStatic) _static = StaticEnumMetadata.Static; VirtualEnumMetadata _virtual = VirtualEnumMetadata.NotVirtual; if (method.IsVirtual) _virtual = VirtualEnumMetadata.Virtual; OverrideEnumMetadata _override = OverrideEnumMetadata.NotOverride; MethodInfo methodInfo = method as MethodInfo; if (methodInfo != null && methodInfo.GetBaseDefinition().DeclaringType != methodInfo.DeclaringType) { _override = OverrideEnumMetadata.Override; } return new Tuple<AccessLevelEnumMetadata, AbstractEnumMetadata, StaticEnumMetadata, VirtualEnumMetadata, OverrideEnumMetadata>(_access, _abstract, _static, _virtual, _override); }
private Tuple <AccessLevelEnumMetadata, SealedEnumMetadata, AbstractEnumMetadata> EmitModifiers(Type type) { //set defaults AccessLevelEnumMetadata _access = AccessLevelEnumMetadata.Private; AbstractEnumMetadata _abstract = AbstractEnumMetadata.NotAbstract; SealedEnumMetadata _sealed = SealedEnumMetadata.NotSealed; // check if not default if (type.IsPublic || type.IsNestedPublic) { _access = AccessLevelEnumMetadata.Public; } else if (type.IsNestedPrivate) { _access = AccessLevelEnumMetadata.Private; } else if (type.IsNestedFamily) { _access = AccessLevelEnumMetadata.Protected; } else if (type.IsNotPublic || type.IsNestedAssembly) { _access = AccessLevelEnumMetadata.Internal; } else if (type.IsNestedFamORAssem || type.IsNestedFamORAssem) { _access = AccessLevelEnumMetadata.ProtectedInternal; } if (type.IsSealed) { _sealed = SealedEnumMetadata.Sealed; } if (type.IsAbstract) { _abstract = AbstractEnumMetadata.Abstract; } return(new Tuple <AccessLevelEnumMetadata, SealedEnumMetadata, AbstractEnumMetadata>(_access, _sealed, _abstract)); }