PostSharp SDK 6.10 / / Class Reference / Post­Sharp.​Sdk.​Code­Model Namespace / Custom­Attribute­Helper Class / Custom­Attribute­Helper Methods / Custom­Attribute­Helper.​Construct­Runtime­Object Method / Custom­Attribute­Helper.​Construct­Runtime­Object(T) Method (IAnnotation­Value, Serialized­Value­Binding­Options)

CustomAttributeHelper.ConstructRuntimeObject<T> Method (IAnnotationValue, SerializedValueBindingOptions)

Construct the instance represented by a given IAnnotationValue, given its type passed as a generic argument, and specifies options. This overload is safe even when the target framework is not .NET Framework.

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 6.10.14.0 (6.10.14.0)
Syntax
C#
public static T ConstructRuntimeObject<T>(
	this IAnnotationValue attribute,
	SerializedValueBindingOptions options
)

Parameters

attribute
Type: PostSharp.Sdk.CodeModel.IAnnotationValue
Custom attribute to be constructed.
options
Type: PostSharp.Sdk.CodeModel.SerializedValueBindingOptions
Options.

Type Parameters

T
Type of the custom attribute.

Return Value

Type: T
A new instance (typically derived from Attribute) constructed on by the constructor represented by the Constructor property and based on the values given in ConstructorArguments and NamedArguments.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IAnnotationValue. 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).
Exceptions
ExceptionCondition
CustomAttributeConstructorExceptionThe constructor or a property setter threw an exception.
See Also