Class AttributesExtensions
- Namespace
 - LinqToDB.Extensions
 
- Assembly
 - linq2db.dll
 
public static class AttributesExtensions
  - Inheritance
 - 
      
      AttributesExtensions
 
- Inherited Members
 
Methods
GetAttribute<T>(ICustomAttributeProvider, bool)
Retrieves first custom attribute applied to a type or type member.
If there are multiple attributes found and inherit set to true, attribute from source preferred.
public static T? GetAttribute<T>(this ICustomAttributeProvider source, bool inherit = true) where T : Attribute
  Parameters
sourceICustomAttributeProviderAn attribute owner.
inheritboolWhen true, look up the hierarchy chain for the inherited custom attribute.
Returns
- T
 A reference to the first custom attribute of type
Tthat is applied to element, ornullif there is no such attribute.
Type Parameters
TThe type of attribute to search for. Only attributes that are assignable to this type are returned.
GetAttributes<T>(ICustomAttributeProvider, bool)
Returns a list of custom attributes applied to a type or type member.
If there are multiple attributes found and inherit set to true, attributes ordered from current to base type in inheritance hierarchy.
public static T[] GetAttributes<T>(this ICustomAttributeProvider source, bool inherit = true) where T : Attribute
  Parameters
sourceICustomAttributeProviderAn attribute owner.
inheritboolWhen
true, look up the hierarchy chain for the inherited custom attribute.
Returns
- T[]
 A list of custom attributes applied to this type, or a list with zero (0) elements if no attributes have been applied.
Type Parameters
TThe type of attribute to search for. Only attributes that are assignable to this type are returned.
HasAttribute<T>(ICustomAttributeProvider, bool)
Check if attribute that implements T type exists on source.
public static bool HasAttribute<T>(this ICustomAttributeProvider source, bool inherit = true) where T : Attribute
  Parameters
sourceICustomAttributeProviderAn attribute owner.
inheritboolWhen true, look up the hierarchy chain for the inherited custom attribute.
Returns
- bool
 Returns
trueif at least one attribute found.
Type Parameters
TThe type of attribute to search for. Only attributes that are assignable to this type are covered.