HostProtectionAttribute.Resources Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit des indicateurs qui spécifient des catégories de fonctionnalités potentiellement dangereuses pour l'hôte.
public:
property System::Security::Permissions::HostProtectionResource Resources { System::Security::Permissions::HostProtectionResource get(); void set(System::Security::Permissions::HostProtectionResource value); };
public System.Security.Permissions.HostProtectionResource Resources { get; set; }
member this.Resources : System.Security.Permissions.HostProtectionResource with get, set
Public Property Resources As HostProtectionResource
Valeur de propriété
Combinaison d'opérations de bits des valeurs HostProtectionResource. La valeur par défaut est None.
Exemples
L’exemple de code suivant illustre l’utilisation de l’attribut HostProtectionAttribute avec la Resources propriété . Cet exemple fait partie d’un exemple plus grand fourni pour 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
Remarques
Les HostProtectionResource indicateurs spécifient les ressources exposées par la méthode ou la classe qui sont potentiellement dangereuses pour l’hôte.