แก้ไข

แชร์ผ่าน


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.

public:
 ContractOptionAttribute(System::String ^ category, System::String ^ setting, bool enabled);
public ContractOptionAttribute (string category, string setting, bool enabled);
new System.Diagnostics.Contracts.ContractOptionAttribute : string * string * bool -> System.Diagnostics.Contracts.ContractOptionAttribute
Public Sub New (category As String, setting As String, enabled As Boolean)

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

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.

public:
 ContractOptionAttribute(System::String ^ category, System::String ^ setting, System::String ^ value);
public ContractOptionAttribute (string category, string setting, string value);
new System.Diagnostics.Contracts.ContractOptionAttribute : string * string * string -> System.Diagnostics.Contracts.ContractOptionAttribute
Public Sub New (category As String, setting As String, value As String)

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:

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

Applies to