private static void CheckAnnotations(MemberInfo member, bool nameSpace, out ImportNamespaceAttribute nameSpaceAttr) { var t = nameSpace ? member.DeclaringType : (Type)member; if (!IsAnnotated(t, out nameSpaceAttr)) { string namespaceError = $"Type \"{t?.Name}\" must be decorated with \"{nameof(ImportNamespaceAttribute)}\""; Guard.Fail(namespaceError); } }
private static bool IsAnnotated(Type t, out ImportNamespaceAttribute attr) { attr = t.GetCustomAttribute <ImportNamespaceAttribute>(); return(attr != null); }