-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Reflection_ReflectionExtensions_TryGetMetadataAttribute__1
Performs search for metadata attribute. The search is performed in the following order * member attributes, base implementation attributes (if the attributeProvider is member of the type) * type attributes, base type attributes (if the attributeProvider is type or member of the type) * container type attributes (if the type is nested type) * assembly attributes.
Namespace: CodeJam.Reflection
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0
C#
public static TAttribute TryGetMetadataAttribute<TAttribute>(
this ICustomAttributeProvider attributeProvider
)
where TAttribute : class
VB
<ExtensionAttribute>
Public Shared Function TryGetMetadataAttribute(Of TAttribute As Class) (
attributeProvider As ICustomAttributeProvider
) As TAttribute
F#
[<ExtensionAttribute>]
static member TryGetMetadataAttribute :
attributeProvider : ICustomAttributeProvider -> 'TAttribute when 'TAttribute : not struct
- attributeProvider
- Type: System.Reflection.ICustomAttributeProvider
Metadata attribute source.
- TAttribute
- Type of the attribute or type of the interface implemented by the attributes.
Type: TAttribute
First attribute found.
In Visual Basic and C#, you can call this method as an instance method on any object of type ICustomAttributeProvider. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Search logic for each level matches to the GetCustomAttributes(MemberInfo, Type, Boolean) method (inherit = true
). including checks of AttributeUsageAttribute. Ordering of attributes at each level is undefined and depends on runtime implementation.
ReflectionExtensions Class
TryGetMetadataAttribute Overload
CodeJam.Reflection Namespace