/// <summary> /// Gets a value indicating whether the method is public. /// </summary> /// <param name="provider">The reflection introspection provider.</param> /// <param name="method">The method to inspect.</param> /// <returns>true if the method is public; otherwise, false.</returns> public static bool IsPublic(this IMethodBaseIntrospectionProvider provider, MethodBase method) => (NotNull(provider).GetAttributes(method) & MethodAttributes.MemberAccessMask) == MethodAttributes.Public;
/// <summary> /// Gets a value indicating whether only a member of the same kind with exactly the same signature is hidden in the derived class. /// </summary> /// <param name="provider">The reflection introspection provider.</param> /// <param name="method">The method to inspect.</param> /// <returns>true if the method is hidden by signature; otherwise, false.</returns> public static bool IsHideBySig(this IMethodBaseIntrospectionProvider provider, MethodBase method) => (NotNull(provider).GetAttributes(method) & MethodAttributes.HideBySig) > MethodAttributes.PrivateScope;
/// <summary> /// Gets a value indicating whether the method is a constructor. /// </summary> /// <param name="provider">The reflection introspection provider.</param> /// <param name="method">The method to check for being a constructor.</param> /// <returns>true if this method is a constructor represented by a <see cref="ConstructorInfo" /> object; otherwise, false.</returns> public static bool IsConstructor(this IMethodBaseIntrospectionProvider provider, MethodBase method) => method is ConstructorInfo && (NotNull(provider).GetAttributes(method) & MethodAttributes.RTSpecialName) == MethodAttributes.RTSpecialName;
/// <summary> /// Gets a value indicating whether the potential visibility of the specified <paramref name="method"/> is described by <see cref="MethodAttributes.FamORAssem" />; that is, the method can be accessed by derived classes wherever they are, and by classes in the same assembly. /// </summary> /// <param name="provider">The reflection introspection provider.</param> /// <param name="method">The method to retrieve visibility for.</param> /// <returns>true if the visibility of the specified <paramref name="method"/> is exactly described by <see cref="MethodAttributes.FamORAssem" />; otherwise, false.</returns> public static bool IsFamilyOrAssembly(this IMethodBaseIntrospectionProvider provider, MethodBase method) => (NotNull(provider).GetAttributes(method) & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem;
/// <summary> /// Gets a value indicating whether the method has a special name. /// </summary> /// <param name="provider">The reflection introspection provider.</param> /// <param name="method">The method to inspect.</param> /// <returns>true if the method has a special name; otherwise, false.</returns> public static bool IsSpecialName(this IMethodBaseIntrospectionProvider provider, MethodBase method) => (NotNull(provider).GetAttributes(method) & MethodAttributes.SpecialName) > MethodAttributes.PrivateScope;