Exemplo n.º 1
0
 /// <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>()));
 }
Exemplo n.º 2
0
 /// <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>());
 }
Exemplo n.º 3
0
 /// <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());
 }
Exemplo n.º 4
0
 /// <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());
 }