ContractOptionAttribute Constructors

Definition

Initializes a new instance of the ContractOptionAttribute class.

Overloads

ContractOptionAttribute(String, String, Boolean)

Initializes a new instance of the ContractOptionAttribute class by using the provided category, setting, and enable/disable value.

ContractOptionAttribute(String, String, String)

Initializes a new instance of the ContractOptionAttribute class by using the provided category, setting, and value.

ContractOptionAttribute(String, String, Boolean)

Source:
Contracts.cs
Source:
Contracts.cs
Source:
Contracts.cs

Initializes a new instance of the ContractOptionAttribute class by using the provided category, setting, and enable/disable value.

C#
public ContractOptionAttribute(string category, string setting, bool enabled);

Parameters

category
String

The category for the option to be set.

setting
String

The option setting.

enabled
Boolean

true to enable the option; false to disable the option.

Applies to

.NET 10 och andra versioner
Produkt Versioner
.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 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 2.0, 2.1
UWP 10.0

ContractOptionAttribute(String, String, String)

Source:
Contracts.cs
Source:
Contracts.cs
Source:
Contracts.cs

Initializes a new instance of the ContractOptionAttribute class by using the provided category, setting, and value.

C#
public ContractOptionAttribute(string category, string setting, string value);

Parameters

category
String

The category of the option to be set.

setting
String

The option setting.

value
String

The value for the setting.

Remarks

There are only two category/setting options, and they can be set by either of the constructor overloads. You can use this overload with the same settings as the ContractOptionAttribute(String, String, Boolean) overload by specifying "true" or "false" in string format; for example:

C#
[ContractOption("contract", "inheritance", "false")]  
class MyConcurrentList<T> : IList<T> {  
   ...  
}  

Applies to

.NET 10 och andra versioner
Produkt Versioner
.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 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 2.0, 2.1
UWP 10.0