HostProtectionResource Enumerazione

Definizione

Attenzione

Code Access Security is not supported or honored by the runtime.

Specifica le categorie di funzionalità potenzialmente dannose per l'host se richiamate da un metodo o una classe.

Questa enumerazione supporta una combinazione bit per bit dei rispettivi valori dei membri.

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
Ereditarietà
HostProtectionResource
Attributi

Campi

All 511

Espone tutte le risorse host.

ExternalProcessMgmt 4

Potrebbe creare o distruggere altri processi.

ExternalThreading 16

Crea o modifica thread diversi dal proprio che potrebbero essere dannosi per l'host.

MayLeakOnAbort 256

Potrebbe provocare una perdita di risorse al termine del processo, se queste non sono protette da un handle sicuro o da altri mezzi per garantire il rilascio delle risorse.

None 0

Non espone alcuna risorsa host.

SecurityInfrastructure 64

Espone l'infrastruttura di sicurezza.

SelfAffectingProcessMgmt 8

Potrebbe arrestare il processo corrente, chiudendo il server.

SelfAffectingThreading 32

Modifica i thread in un modo che influisce solo sul codice utente.

SharedState 2

Espone lo stato che potrebbe essere condiviso tra i thread.

Synchronization 1

Espone la sincronizzazione.

UI 128

Espone l'interfaccia utente.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso dell'enumerazione HostProtectionResource con l'attributo HostProtectionAttribute . Questo esempio fa parte di un esempio più ampio fornito per la HostProtectionAttribute classe .

// 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

Commenti

Questa enumerazione viene utilizzata dall'attributo HostProtectionAttribute .

Si applica a