Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Attribute.GetCustomAttribute Method (Assembly, Type)

Retrieves a custom attribute applied to a specified assembly. Parameters specify the assembly and the type of the custom attribute to search for.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)
public static Attribute GetCustomAttribute(
	Assembly element,
	Type attributeType
)

Parameters

element
Type: System.Reflection.Assembly
An object derived from the Assembly class that describes a reusable collection of modules.
attributeType
Type: System.Type
The type, or a base type, of the custom attribute to search for.

Return Value

Type: System.Attribute
A reference to the single custom attribute of type attributeType that is applied to element, or null if there is no such attribute.
ExceptionCondition
ArgumentNullException

element or attributeType is null.

ArgumentException

attributeType is not derived from Attribute.

AmbiguousMatchException

More than one of the requested attributes was found.

Use the GetCustomAttributes method if you expect more than one value to be returned, or AmbiguousMatchException will be thrown.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.