HostProtectionResource 열거형

정의

주의

Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}

메서드나 클래스에 의해 호출되는 경우 호스트를 손상시킬 가능성이 있는 기능의 범주를 지정합니다.Specifies categories of functionality potentially harmful to the host if invoked by a method or class.

이 열거형에는 멤버 값의 비트 조합을 허용하는 FlagsAttribute 특성이 있습니다.

public enum class HostProtectionResource
[System.Flags]
public enum HostProtectionResource
[System.Flags]
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum HostProtectionResource
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum HostProtectionResource
[<System.Flags>]
type HostProtectionResource = 
[<System.Flags>]
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type HostProtectionResource = 
[<System.Flags>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type HostProtectionResource = 
Public Enum HostProtectionResource
상속
HostProtectionResource
특성

필드

All 511

모든 호스트 리소스를 노출합니다.Exposes all host resources.

ExternalProcessMgmt 4

다른 프로세스를 만들거나 소멸시킬 수 있습니다.Might create or destroy other processes.

ExternalThreading 16

해당 스레드를 제외하고 호스트를 손상시킬 수 있는 스레드를 만들거나 조작합니다.Creates or manipulates threads other than its own, which might be harmful to the host.

MayLeakOnAbort 256

안전한 핸들이나 다른 리소스 해제 방법을 사용하여 보호되지 않은 상태에서 종료하면 리소스 누수가 발생할 수 있습니다.Might cause a resource leak on termination, if not protected by a safe handle or some other means of ensuring the release of resources.

None 0

호스트 리소스를 노출하지 않습니다.Exposes no host resources.

SecurityInfrastructure 64

보안 인프라를 노출합니다.Exposes the security infrastructure.

SelfAffectingProcessMgmt 8

현재 프로세스를 끝내고 서버를 종료시킬 수 있습니다.Might exit the current process, terminating the server.

SelfAffectingThreading 32

사용자 코드에만 영향을 주는 방법으로 스레드를 조작합니다.Manipulates threads in a way that only affects user code.

SharedState 2

스레드 사이에서 공유할 수 있는 상태를 노출합니다.Exposes state that might be shared between threads.

Synchronization 1

동기화를 노출합니다.Exposes synchronization.

UI 128

사용자 인터페이스를 노출합니다.Exposes the user interface.

예제

다음 코드 예제에서는 특성을 사용 하 여 열거형을 사용 하는 방법을 보여 줍니다 HostProtectionResource HostProtectionAttribute .The following code example shows the use of the HostProtectionResource enumeration with the HostProtectionAttribute attribute. 이 예제는에 대해 제공 된 큰 예제의 일부는 HostProtectionAttribute 클래스입니다.This example is part of a larger example provided for the HostProtectionAttribute class.

// Use the enumeration flags to indicate that this method exposes shared state and 
// self-affecting process management.
// Either of the following attribute statements can be used to set the 
// resource flags.
// Exit the sample when an exception is thrown.

[HostProtection(SharedState=true,SelfAffectingProcessMgmt=true)]
[HostProtection(Resources=HostProtectionResource::SharedState|
HostProtectionResource::SelfAffectingProcessMgmt)]
static void Exit( String^ Message, int Code )
{
   Console::WriteLine( "\nFAILED: {0} {1}", Message, Code );
   Environment::ExitCode = Code;
   Environment::Exit( Code );
}
// Use the enumeration flags to indicate that this method exposes 
// shared state and self-affecting process management.
// Either of the following attribute statements can be used to set the
// resource flags.
[HostProtectionAttribute(SharedState = true, 
    SelfAffectingProcessMgmt = true)]
[HostProtectionAttribute(Resources = HostProtectionResource.SharedState |
     HostProtectionResource.SelfAffectingProcessMgmt)]
private static void Exit(string Message, int Code)
{
    // Exit the sample when an exception is thrown.
    Console.WriteLine("\nFAILED: " + Message + " " + Code.ToString());
    Environment.ExitCode = Code;
    Environment.Exit(Code);
}
' Use the enumeration flags to indicate that this method exposes 
' shared state and self-affecting process management.
' Either of the following attribute statements can be used to set the 
' resource flags.
<HostProtectionAttribute(SharedState := True, _
    SelfAffectingProcessMgmt := True), _
    HostProtectionAttribute( _
    Resources := HostProtectionResource.SharedState Or _
    HostProtectionResource.SelfAffectingProcessMgmt)> _
Private Shared Sub [Exit](ByVal Message As String, ByVal Code As Integer)

    ' Exit the sample when an exception is thrown.
    Console.WriteLine((ControlChars.Lf & "FAILED: " & Message & " " & _
        Code.ToString()))
    Environment.ExitCode = Code
    Environment.Exit(Code)
End Sub

설명

이 열거형은 특성에서 사용 됩니다 HostProtectionAttribute .This enumeration is used by the HostProtectionAttribute attribute.

적용 대상