Export (0) Print
Expand All

ReliabilityContractAttribute Class

Defines a contract for reliability between the author of some code, and the developers who have a dependency on that code.

Namespace: System.Runtime.ConstrainedExecution
Assembly: mscorlib (in mscorlib.dll)

[AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Interface, Inherited=false)] 
public sealed class ReliabilityContractAttribute : Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Interface, Inherited=false) */ 
public final class ReliabilityContractAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Interface, Inherited=false) 
public final class ReliabilityContractAttribute extends Attribute
Not applicable.

The ReliabilityContractAttribute attribute provides a mechanism for you to document your code, and to indicate what type of reliability guarantees you can make in the face of exceptional conditions that could potentially lead to an inconsistent state. In this context, exceptional conditions are defined as asynchronous exceptions that can be generated at run time by the common language runtime, such as aborted threads, out-of-memory situations, and stack overflows. You can apply the ReliabilityContractAttribute attribute to assemblies, types, and methods.

Use this attribute with the Consistency enumeration to define a reliability contract by documenting the level of reliability in a particular piece of code.

The following code example demonstrates the use of the ReliabilityContractAttribute attribute to document the level of reliability of an assembly.

using System;
using System.Runtime.ConstrainedExecution;

[assembly:ReliabilityContractAttribute(
   Consistency.MayCorruptInstance, Cer.None)]
namespace ReliabilityLibrary
{
   class SomeClass {}
}

System.Object
   System.Attribute
    System.Runtime.ConstrainedExecution.ReliabilityContractAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft