System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute Class

Specifies that a field can be used in method contracts when the field has less visibility than the method.

See Also: ContractPublicPropertyNameAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Field)]
[System.Diagnostics.Conditional("CONTRACTS_FULL")]
public sealed class ContractPublicPropertyNameAttribute : Attribute

Remarks

When you apply the System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute attribute to a field, that field can be used in the code contracts for a method when the field has less visibility than the method. There must be a visible property that is equivalent to the value of the field. For example, you can use this attribute if the method is public, but the field is private.

Requirements

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