Consistency 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
주의
The Constrained Execution Region (CER) feature is not supported.
안정성 계약을 지정합니다.
public enum class Consistency
[System.Obsolete("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId="SYSLIB0004", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum Consistency
public enum Consistency
[System.Serializable]
public enum Consistency
[<System.Obsolete("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId="SYSLIB0004", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type Consistency =
type Consistency =
[<System.Serializable>]
type Consistency =
Public Enum Consistency
- 상속
- 특성
필드
| Name | 값 | Description |
|---|---|---|
| MayCorruptProcess | 0 | 예외적인 조건에도 CLR은 상태 일관성을 보장하지 않습니다. 즉, 조건이 프로세스를 손상할 수 있습니다. |
| MayCorruptAppDomain | 1 | 예외적인 조건에도 CLR(공용 언어 런타임)은 현재 애플리케이션 도메인의 상태 일관성을 보장하지 않습니다. |
| MayCorruptInstance | 2 | 예외적인 조건에 직면하여 이 메서드는 상태 손상을 현재 인스턴스로 제한하도록 보장됩니다. |
| WillNotCorruptState | 3 | 예외적 조건에도 이 메서드는 손상된 상태를 보장하지 않습니다. (이렇게 해서 메서드가 실패하지는 않을 것이라고 보장할 수는 없습니다. 그러나 이러한 오류는 상태가 손상되지 않습니다.) |
예제
다음 코드 예제에서는 메서드에 Consistency 대해 제한된 실행 영역을 지정할 때 열거형을 사용하는 방법을 보여 줍니다. 이 코드 예제는 생성자에 대해 제공되는 더 큰 예제의 ReliabilityContractAttribute 일부입니다.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.NoInlining)]
void StackDepth2()
{
try
{
consistentLevel2 = false;
if (depth == 2)
Thread.Sleep(-1);
StackDepth3();
}
finally
{
consistentLevel2 = true;
}
}
<ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)>
<MethodImpl(MethodImplOptions.NoInlining)>
Sub StackDepth2()
Try
consistentLevel2 = False
If depth = 2 Then Thread.Sleep(-1)
StackDepth3()
Finally
consistentLevel2 = True
End Try
End Sub
설명
Consistency 열거형은 특정 메서드의 신뢰성 보장을 명확히 하기 위해 ReliabilityContractAttribute 속성의 매개 변수로 사용됩니다.