HostProtectionResource Enumeración

Definición

Precaución

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

Especifica categorías de funcionalidad potencialmente dañina para el host si lo invoca un método o una clase.

Esta enumeración admite una combinación bit a bit de sus valores de miembro.

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
Herencia
HostProtectionResource
Atributos

Campos

All 511

Expone todos los recursos del host.

ExternalProcessMgmt 4

Podría crear o destruir otros procesos.

ExternalThreading 16

Crea o manipula los subprocesos distintos de los suyos propios, lo que podría ser dañino para el host.

MayLeakOnAbort 256

Si no está protegido por un controlador seguro o algún otro medio para garantizar la liberación de recursos, se podría producir una pérdida de recursos al finalizar.

None 0

No expone ningún recurso del host.

SecurityInfrastructure 64

Expone la infraestructura de seguridad.

SelfAffectingProcessMgmt 8

Podría salir del proceso actual, finalizando el servidor.

SelfAffectingThreading 32

Manipula los subprocesos de un modo que sólo afecta al código del usuario.

SharedState 2

Expone el estado que se podría compartir entre los subprocesos.

Synchronization 1

Expone la sincronización.

UI 128

Expone la interfaz de usuario.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de la HostProtectionResource enumeración con el HostProtectionAttribute atributo . Este ejemplo forma parte de un ejemplo más grande proporcionado para la HostProtectionAttribute clase .

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

Comentarios

El atributo usa HostProtectionAttribute esta enumeración.

Se aplica a