Show / Hide Table of Contents

Class Type<T>.Attribute<TAttribute>

Provides typed access to the type attribute.

Inheritance
Object
Type<T>.Attribute<TAttribute>
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Attribute<TAttribute>

    where TAttribute : Attribute
Type Parameters
Name Description
TAttribute

Type of attribute.

Methods

| Improve this Doc View Source

Get(Boolean, Predicate<TAttribute>)

Returns attribute associated with the type T.

Declaration
public static TAttribute Get(bool inherit = false, Predicate<TAttribute> condition = null)
Parameters
Type Name Description
Boolean inherit

True to find inherited attribute.

Predicate<TAttribute> condition

Optional predicate to check attribute properties.

Returns
Type Description
TAttribute

Attribute associated with type T; or null, if attribute doesn't exist.

| Improve this Doc View Source

GetAll(Boolean, Predicate<TAttribute>)

Get all custom attributes of type TAttribute.

Declaration
public static IEnumerable<TAttribute> GetAll(bool inherit = false, Predicate<TAttribute> condition = null)
Parameters
Type Name Description
Boolean inherit

True to find inherited attribute.

Predicate<TAttribute> condition

Optional predicate to check attribute properties.

Returns
Type Description
IEnumerable<TAttribute>

All attributes associated with type T.

| Improve this Doc View Source

Require(Boolean, Predicate<TAttribute>)

Returns attribute associated with the type T.

Declaration
public static TAttribute Require(bool inherit = false, Predicate<TAttribute> condition = null)
Parameters
Type Name Description
Boolean inherit

True to find inherited attribute.

Predicate<TAttribute> condition

Optional predicate to check attribute properties.

Returns
Type Description
TAttribute

Attribute associated with type T.

Exceptions
Type Condition
MissingAttributeException

Event doesn't exist.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX