Open sandboxFocus

Method TryConstruct

TryConstruct(IAttribute, ScopedDiagnosticSink, out Attribute?)

Tries to construct an instance of the attribute represented by the current IAttribute. The attribute type must not be a run-time-only type.

Declaration
public static bool TryConstruct(this IAttribute attribute, ScopedDiagnosticSink diagnosticSink, out Attribute? constructedAttribute)
Parameters
Type Name Description
IAttribute attribute

The attribute to construct.

ScopedDiagnosticSink diagnosticSink

A sink for reporting diagnostics during construction.

Attribute constructedAttribute

When this method returns true, contains the constructed attribute instance; otherwise, null.

Returns
Type Description
bool

true if the attribute was successfully constructed; otherwise, false.

TryConstruct(IAttribute, out Attribute?)

Tries to construct an instance of the attribute represented by the current IAttribute. The attribute type must not be a run-time-only type.

Declaration
public static bool TryConstruct(this IAttribute attribute, out Attribute? constructedAttribute)
Parameters
Type Name Description
IAttribute attribute

The attribute to construct.

Attribute constructedAttribute

When this method returns true, contains the constructed attribute instance; otherwise, null.

Returns
Type Description
bool

true if the attribute was successfully constructed; otherwise, false.