ReliabilityContractAttribute Klasa

Definicja

Przestroga

The Constrained Execution Region (CER) feature is not supported.

Definiuje kontrakt dotyczący niezawodności między autorem kodu a deweloperami, którzy mają zależność od tego kodu.

public ref class ReliabilityContractAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
[System.Obsolete("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId="SYSLIB0004", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class ReliabilityContractAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
public sealed class ReliabilityContractAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)>]
[<System.Obsolete("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId="SYSLIB0004", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type ReliabilityContractAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)>]
type ReliabilityContractAttribute = class
    inherit Attribute
Public NotInheritable Class ReliabilityContractAttribute
Inherits Attribute
Dziedziczenie
ReliabilityContractAttribute
Atrybuty

Przykłady

Poniższy przykład kodu przedstawia użycie atrybutu ReliabilityContractAttribute w celu udokumentowania poziomu niezawodności zestawu.

using namespace System;
using namespace System::Runtime::ConstrainedExecution;

[assembly:ReliabilityContractAttribute(
   Consistency::MayCorruptInstance, Cer::None)];
namespace ReliabilityLibrary
{
   class SomeClass {};
}
using System;
using System.Runtime.ConstrainedExecution;

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

<assembly:ReliabilityContractAttribute( _ 
   Consistency.MayCorruptInstance, Cer.None)> 
Namespace ReliabilityLibrary
   Class SomeClass
   End Class
End Namespace

Uwagi

Atrybut ReliabilityContractAttribute zapewnia mechanizm dokumentowania kodu i wskazuje, jakiego typu gwarancje niezawodności można wprowadzić w obliczu wyjątkowych warunków, które mogą potencjalnie prowadzić do niespójnego stanu. W tym kontekście wyjątkowe warunki są definiowane jako wyjątki asynchroniczne, które mogą być generowane w czasie wykonywania przez środowisko uruchomieniowe języka wspólnego, takie jak przerwane wątki, sytuacje poza pamięcią i przepełnienia stosu. Atrybut można zastosować ReliabilityContractAttribute do zestawów, typów i metod.

Użyj tego atrybutu Consistency z wyliczeniem, aby zdefiniować kontrakt niezawodności, dokumentując poziom niezawodności w określonym fragmentowaniu kodu.

Konstruktory

ReliabilityContractAttribute(Consistency, Cer)
Przestarzałe.

Inicjuje ReliabilityContractAttribute nowe wystąpienie klasy z określoną Consistency gwarancją i Cer wartością.

Właściwości

Cer
Przestarzałe.

Pobiera wartość określającą zachowanie metody, typu lub zestawu, gdy jest wywoływana w regionie wykonywania ograniczonego (CER).

ConsistencyGuarantee
Przestarzałe.

Pobiera wartość kontraktu Consistency niezawodności.

TypeId
Przestarzałe.

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego elementu Attribute.

(Odziedziczone po Attribute)

Metody

Equals(Object)
Przestarzałe.

Zwraca wartość wskazującą, czy to wystąpienie jest równe podanemu obiektowi.

(Odziedziczone po Attribute)
GetHashCode()
Przestarzałe.

Zwraca wartość skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()
Przestarzałe.

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
IsDefaultAttribute()
Przestarzałe.

W przypadku zastąpienia w klasie pochodnej wskazuje, czy wartość tego wystąpienia jest wartością domyślną klasy pochodnej.

(Odziedziczone po Attribute)
Match(Object)
Przestarzałe.

W przypadku zastąpienia w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()
Przestarzałe.

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()
Przestarzałe.

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
Przestarzałe.

Zestaw nazw jest mapowany na odpowiedni zestaw identyfikatorów wysyłania.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
Przestarzałe.

Pobiera informacje o typie obiektu, którego można użyć do pobrania informacji o typie interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)
Przestarzałe.

Pobiera informację o liczbie typów interfejsów, jakie zawiera obiekt (0 lub 1).

(Odziedziczone po Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
Przestarzałe.

Umożliwia dostęp do właściwości i metod udostępnianych przez obiekt.

(Odziedziczone po Attribute)

Dotyczy

Zobacz też