ContractOptionAttribute Constructor (String, String, String)

.NET Framework (current version)

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

Namespace:   System.Diagnostics.Contracts
Assembly:  mscorlib (in mscorlib.dll)

public ContractOptionAttribute(
	string category,
	string setting,
	string value


Type: System.String

The category of the option to be set.

Type: System.String

The option setting.

Type: System.String

The value for the setting.

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> {

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top