Example #1
0
    /// <summary>
    /// Gets all the custom attributes for the given attribute.
    /// </summary>
    /// <param name="attributeInfo">The attribute</param>
    /// <param name="attributeType">The type of the attribute to find</param>
    /// <returns>The matching attributes that decorate the attribute</returns>
    public static IEnumerable <_IAttributeInfo> GetCustomAttributes(this _IAttributeInfo attributeInfo, Type attributeType)
    {
        Guard.ArgumentNotNull(nameof(attributeInfo), attributeInfo);
        Guard.ArgumentNotNull(nameof(attributeType), attributeType);
        Guard.NotNull("Attribute type cannot be a generic type parameter", attributeType.AssemblyQualifiedName);

        return(attributeInfo.GetCustomAttributes(attributeType.AssemblyQualifiedName));
    }
Example #2
0
    /// <summary>
    /// Gets all the custom attributes for the given attribute.
    /// </summary>
    /// <param name="attributeInfo">The attribute</param>
    /// <param name="attributeType">The type of the attribute to find</param>
    /// <returns>The matching attributes that decorate the attribute</returns>
    public static IReadOnlyCollection <_IAttributeInfo> GetCustomAttributes(this _IAttributeInfo attributeInfo, Type attributeType)
    {
        Guard.ArgumentNotNull(attributeInfo);
        Guard.ArgumentNotNull(attributeType);
        Guard.NotNull("Attribute type cannot be a generic type parameter", attributeType.AssemblyQualifiedName);

        return(attributeInfo.GetCustomAttributes(attributeType.AssemblyQualifiedName));
    }