HostProtectionResource Sabit listesi

Tanım

Dikkat

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

Bir yöntem veya sınıf tarafından çağrılırsa konak için zararlı olabilecek işlevsellik kategorilerini belirtir.

Bu sabit listesi, üyeleri için bit düzeyinde karşılaştırmayı destekler.

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
Devralma
HostProtectionResource
Öznitelikler

Alanlar

All 511

Tüm konak kaynaklarını kullanıma sunar.

ExternalProcessMgmt 4

Diğer işlemleri oluşturabilir veya yok edebilir.

ExternalThreading 16

Konak için zararlı olabilecek kendi iş parçacıkları dışında iş parçacıklarını oluşturur veya düzenler.

MayLeakOnAbort 256

Güvenli tanıtıcı veya kaynakların serbest bırakılmasını sağlamak için başka bir yolla korunmazsa sonlandırmada kaynak sızıntısına neden olabilir.

None 0

Hiçbir konak kaynağını kullanıma sunmaz.

SecurityInfrastructure 64

Güvenlik altyapısını kullanıma sunar.

SelfAffectingProcessMgmt 8

Geçerli işlemden çıkıp sunucuyu sonlandırabilir.

SelfAffectingThreading 32

İş parçacıklarını yalnızca kullanıcı kodunu etkileyecek şekilde düzenler.

SharedState 2

İş parçacıkları arasında paylaşılabilen durumu kullanıma sunar.

Synchronization 1

Eşitlemeyi kullanıma sunar.

UI 128

Kullanıcı arabirimini kullanıma sunar.

Örnekler

Aşağıdaki kod örneği, numaralandırmanın HostProtectionResource özniteliğiyle HostProtectionAttribute kullanımını gösterir. Bu örnek, sınıfı için HostProtectionAttribute sağlanan daha büyük bir örneğin parçasıdır.

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

Açıklamalar

Bu numaralandırma özniteliği tarafından HostProtectionAttribute kullanılır.

Şunlara uygulanır