/// <summary> /// Gets the attributes of the given type which are defined on the context or on the type. /// </summary> /// <typeparam name="T">The attribute type.</typeparam> /// <returns>The attributes.</returns> public IEnumerable <T> GetAttributes <T>() { return(ContextAttributes.OfType <T>().Concat(TypeAttributes.OfType <T>())); }
/// <summary> /// Gets the attributes of the given type which are defined on the type. /// </summary> /// <typeparam name="T">The attribute type.</typeparam> /// <returns>The attributes.</returns> public IEnumerable <T> GetTypeAttributes <T>() { return(TypeAttributes.OfType <T>()); }
/// <summary> /// Gets an attribute of the given type which is defined on the context or on the type. /// </summary> /// <typeparam name="T">The attribute type.</typeparam> /// <returns>The attribute or null.</returns> public T?GetAttribute <T>() { return(ContextAttributes.OfType <T>().Concat(TypeAttributes.OfType <T>()).FirstOrDefault()); }
/// <summary> /// Gets an attribute of the given type which is defined on the type. /// </summary> /// <typeparam name="T">The attribute type.</typeparam> /// <returns>The attribute or null.</returns> public T GetTypeAttribute <T>() where T : Attribute { return(TypeAttributes.OfType <T>().SingleOrDefault()); }