RequiresUnreferencedCodeAttribute Class

Definition

Indicates that the specified method requires dynamic access to code that is not referenced statically, for example, through System.Reflection.

public ref class RequiresUnreferencedCodeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed class RequiresUnreferencedCodeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed class RequiresUnreferencedCodeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)>]
type RequiresUnreferencedCodeAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)>]
type RequiresUnreferencedCodeAttribute = class
    inherit Attribute
Public NotInheritable Class RequiresUnreferencedCodeAttribute
Inherits Attribute
Inheritance
RequiresUnreferencedCodeAttribute
Attributes

Remarks

This attribute allows tools to understand which methods are unsafe to call when removing unreferenced code from an application. For more information, see Introduction to trim warnings.

Constructors

Name Description
RequiresUnreferencedCodeAttribute(String)

Initializes a new instance of the RequiresUnreferencedCodeAttribute class with the specified message.

Properties

Name Description
ExcludeStatics

Gets or sets a value that indicates whether the annotation should apply to static members.

Message

Gets a message that contains information about the usage of unreferenced code.

TypeId

When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)