Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ReflectionUtils.CreateCustomAttribute(Type, Object, Attribute) Method

Creates a CustomAttributeBuilder.

[Visual Basic]
Public Overloads Shared Sub CreateCustomAttribute( _
   ByVal type As Type, _
   ByVal ctorArgs As Object, _
   ByVal sourceAttribute As Attribute _
)
[C#]
public static CustomAttributeBuilder CreateCustomAttribute(
   Type type,
   object[] ctorArgs,
   Attribute sourceAttribute
);

Parameters

type
The desired AttributeType.
ctorArgs
Any constructor arguments for the attribute (may be a null reference (Nothing in Visual Basic) in the case of no arguments).
sourceAttribute
Source attribute to copy properties from (may be a null reference (Nothing in Visual Basic)).

Return Value

A custom attribute builder.

Remarks

Note that if a non-a null reference (Nothing in Visual Basic)sourceAttribute is supplied, any read write properties exposed by the sourceAttribute will be used to overwrite values that may have been passed in via the ctorArgs. That is, the ctorArgs will be used to initialize the custom attribute, and then any read-write properties on the sourceAttribute will be plugged in.

Exceptions

Exception Type Condition
ArgumentNullException If the type parameter is a null reference (Nothing in Visual Basic).
ArgumentNullException If the type parameter is not a Type that derives from the Attribute class.

See Also

ReflectionUtils Class | Spring.Util Namespace | ReflectionUtils.CreateCustomAttribute Overload List | CustomAttributeBuilder