Show / Hide Table of Contents

Class AssemblyExtensions

Extensions various for Assembly objects.

Inheritance
object
AssemblyExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.dll
Syntax
public static class AssemblyExtensions

Methods

| Edit this page View Source

GetAttribute<T>(Assembly)

Gets the attribute associated with the specified assembly.

Declaration
public static T? GetAttribute<T>(this Assembly assembly) where T : Attribute
Parameters
Type Name Description
Assembly assembly

The Assembly from which the attribute will be extracted.

Returns
Type Description
T

An attribute of the type T with the data associated in the assembly declaration; or null if the specified attribute is not found.

Type Parameters
Name Description
T

Type of the attribute to return. Must inherit from Attribute.

Exceptions
Type Condition
ArgumentNullException

Thrown if assembly is null.

| Edit this page View Source

GetAttributes<T>(Assembly)

Gets the attribute associated with the specified assembly.

Declaration
public static IEnumerable<T> GetAttributes<T>(this Assembly assembly) where T : Attribute
Parameters
Type Name Description
Assembly assembly

The Assembly from which the attribute will be extracted.

Returns
Type Description
IEnumerable<T>

An attribute of the type T with the data associated in the assembly declaration; or null if the specified attribute is not found.

Type Parameters
Name Description
T

Type of the attribute to return. Must inherit from Attribute.

Exceptions
Type Condition
ArgumentNullException

Thrown if assembly is null.

| Edit this page View Source

HasAttrValue<TAttribute, TValue>(Assembly, out TValue)

Determines if a member possesses a defined attribute.

Declaration
public static bool HasAttrValue<TAttribute, TValue>(this Assembly assembly, out TValue value) where TAttribute : Attribute, IValueAttribute<TValue>
Parameters
Type Name Description
Assembly assembly

Member from which the attribute will be extracted.

TValue value

Out parameter. If an attribute of type TAttribute has been found, the value of the same is returned. default will be returned if the member does not possess the attribute specified.

Returns
Type Description
bool

true if the member possesses the attribute, false otherwise.

Type Parameters
Name Description
TAttribute

Type of the attribute to search for. Must inherit from Attribute and from IValueAttribute<T>.

TValue

Type of the value to return.

| Edit this page View Source

HasAttribute<T>(Assembly)

Determines if a member possesses a defined attribute.

Declaration
public static bool HasAttribute<T>(this Assembly assembly) where T : Attribute
Parameters
Type Name Description
Assembly assembly

Member from which the attribute will be extracted.

Returns
Type Description
bool

true if the member possesses the attribute, false otherwise.

Type Parameters
Name Description
T

Type of the attribute to return. Must inherit from Attribute.

| Edit this page View Source

HasAttribute<T>(Assembly, out T?)

Determines if a member possesses a defined attribute.

Declaration
public static bool HasAttribute<T>(this Assembly assembly, out T? attribute) where T : notnull, Attribute
Parameters
Type Name Description
Assembly assembly

Member from which the attribute will be extracted.

T attribute

Out parameter. If an attribute of type T has been found, it is returned. null will be returned if the member does not possess the specified attribute.

Returns
Type Description
bool

true if the member possesses the attribute, false otherwise.

Type Parameters
Name Description
T

Type of the attribute to return. Must inherit from Attribute.

| Edit this page View Source

HasAttributes<T>(Assembly, out IEnumerable<T>)

Determines if a member possesses a defined attribute.

Declaration
public static bool HasAttributes<T>(this Assembly assembly, out IEnumerable<T> attribute) where T : Attribute
Parameters
Type Name Description
Assembly assembly

Member from which the attribute will be extracted.

IEnumerable<T> attribute

Out parameter. If an attribute of type T has been found, it is returned. null will be returned if the member does not possess the specified attribute.

Returns
Type Description
bool

true if the member possesses the attribute, false otherwise.

Type Parameters
Name Description
T

Type of the attribute to return. Must inherit from Attribute.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX