Ler en inglés Editar

Compartir por


ObsoleteAttribute Constructors

Definition

Initializes a new instance of the ObsoleteAttribute class.

Overloads

ObsoleteAttribute()

Initializes a new instance of the ObsoleteAttribute class with default properties.

ObsoleteAttribute(String)

Initializes a new instance of the ObsoleteAttribute class with a specified workaround message.

ObsoleteAttribute(String, Boolean)

Initializes a new instance of the ObsoleteAttribute class with a workaround message and a Boolean value indicating whether the obsolete element usage is considered an error.

ObsoleteAttribute()

Source:
ObsoleteAttribute.cs
Source:
ObsoleteAttribute.cs
Source:
ObsoleteAttribute.cs

Initializes a new instance of the ObsoleteAttribute class with default properties.

C#
public ObsoleteAttribute();

Remarks

The following table shows the initial property values for an instance of ObsoleteAttribute.

Property Value
IsError false
Message null
DiagnosticId null
UrlFormat null

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0

ObsoleteAttribute(String)

Source:
ObsoleteAttribute.cs
Source:
ObsoleteAttribute.cs
Source:
ObsoleteAttribute.cs

Initializes a new instance of the ObsoleteAttribute class with a specified workaround message.

C#
public ObsoleteAttribute(string message);
C#
public ObsoleteAttribute(string? message);

Parameters

message
String

The text string that describes alternative workarounds.

Remarks

The following table shows the initial property values for an instance of ObsoleteAttribute.

Property Value
IsError false.
Message The workaround message.
DiagnosticId null.
UrlFormat null.

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0

ObsoleteAttribute(String, Boolean)

Source:
ObsoleteAttribute.cs
Source:
ObsoleteAttribute.cs
Source:
ObsoleteAttribute.cs

Initializes a new instance of the ObsoleteAttribute class with a workaround message and a Boolean value indicating whether the obsolete element usage is considered an error.

C#
public ObsoleteAttribute(string message, bool error);
C#
public ObsoleteAttribute(string? message, bool error);

Parameters

message
String

The text string that describes alternative workarounds.

error
Boolean

true if the obsolete element usage generates a compiler error; false if it generates a compiler warning.

Remarks

The following table shows the initial property values for an instance of ObsoleteAttribute.

Property Value
IsError The error value.
Message The message value.
DiagnosticId null.
UrlFormat null.

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0