コード例 #1
0
 /// <summary>
 /// Determines whether the custom attribute of the specified <paramref name="attributeType"/> type or its derived types is applied to the specified <paramref name="member"/>.
 /// </summary>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="member">The member to check the custom attribute on.</param>
 /// <param name="attributeType">The type of attribute to search for.</param>
 /// <returns>true if one or more instances of <paramref name="attributeType" /> or its derived types are applied to the specified <paramref name="member"/>; otherwise, false.</returns>
 public static bool IsDefined(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType)
 => NotNull(provider).IsDefined(member, attributeType, inherit: true);
コード例 #2
0
 /// <summary>
 /// Gets the single custom attribute of the specified type <typeparamref name="T"/> applied to the specified <paramref name="member"/>.
 /// </summary>
 /// <typeparam name="T">The type of the custom attribute to retrieve.</typeparam>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="member">The member to get the custom attribute from.</param>
 /// <param name="inherit">Indicates whether or not to retrieve attributes from a base type.</param>
 /// <returns>The single applied custom attribute instance, or null if no such attribute was found.</returns>
 public static T GetCustomAttribute <T>(this IMemberInfoIntrospectionProvider provider, MemberInfo member, bool inherit) where T : Attribute
 => Single(NotNull(provider).GetCustomAttributes <T>(member, inherit));
コード例 #3
0
 /// <summary>
 /// Gets the single custom attribute of the specified type applied to the specified <paramref name="member"/>.
 /// </summary>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="member">The member to get the custom attribute from.</param>
 /// <param name="attributeType">The type for which the custom attribute is to be returned. </param>
 /// <param name="inherit">Indicates whether or not to retrieve attributes from a base type.</param>
 /// <returns>The single applied custom attribute instance, or null if no such attribute was found.</returns>
 public static Attribute GetCustomAttribute(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType, bool inherit)
 => Single(GetCustomAttributes(provider, member, attributeType, inherit));
コード例 #4
0
 /// <summary>
 /// Gets the custom attributes of the specified type <typeparamref name="T"/> applied to the specified <paramref name="member"/>.
 /// </summary>
 /// <typeparam name="T">The type of the custom attributes to retrieve.</typeparam>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="member">The member to get custom attributes from.</param>
 /// <param name="inherit">Indicates whether or not to retrieve attributes from a base type.</param>
 /// <returns>A read-only list of custom attribute instances.</returns>
 public static IReadOnlyList <T> GetCustomAttributes <T>(this IMemberInfoIntrospectionProvider provider, MemberInfo member, bool inherit) where T : Attribute
 => (IReadOnlyList <T>)NotNull(provider).GetCustomAttributes(member, typeof(T), inherit);
コード例 #5
0
 /// <summary>
 /// Gets all the custom attributes for the specified <paramref name="member"/>.
 /// </summary>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="member">The member to get custom attributes for.</param>
 /// <param name="inherit">Indicates whether or not to retrieve attributes from a base type.</param>
 /// <returns>An array that contains the custom attributes for the specified <paramref name="member"/>.</returns>
 public static IReadOnlyList <Attribute> GetCustomAttributes(this IMemberInfoIntrospectionProvider provider, MemberInfo member, bool inherit)
 => (IReadOnlyList <Attribute>)NotNull(provider).GetCustomAttributes(member, typeof(Attribute), inherit);
コード例 #6
0
 /// <summary>
 /// Gets all the custom attributes for the specified <paramref name="member"/> as specified by type.
 /// </summary>
 /// <param name="provider">The reflection provider.</param>
 /// <param name="member">The member to get custom attributes for.</param>
 /// <param name="attributeType">The type for which the custom attributes are to be returned. </param>
 /// <returns>An array that contains the custom attributes for the specified <paramref name="member"/>.</returns>
 public static IReadOnlyList <Attribute> GetCustomAttributes(this IMemberInfoIntrospectionProvider provider, MemberInfo member, Type attributeType)
 => (IReadOnlyList <Attribute>)NotNull(provider).GetCustomAttributes(member, attributeType, inherit: true);