HostProtectionAttribute.Resources HostProtectionAttribute.Resources HostProtectionAttribute.Resources HostProtectionAttribute.Resources Property

Определение

Получает или задает флаги, определяющие категории функциональных возможностей, которые могут быть потенциально опасны.Gets or sets flags specifying categories of functionality that are potentially harmful to the host.

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

Значение свойства

Поразрядное сочетание значений HostProtectionResource.A bitwise combination of the HostProtectionResource values. Значение по умолчанию — None.The default is None.

Примеры

В следующем примере кода показано использование HostProtectionAttribute атрибут Resources свойство.The following code example illustrates the use of the HostProtectionAttribute attribute with the Resources property. Этот пример является частью большего примера для 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 'Exit

Комментарии

HostProtectionResource Флаги определяют ресурсы, предоставляемые метода или класса, которые могут быть потенциально опасны для узла.The HostProtectionResource flags specify the resources exposed by the method or class that are potentially harmful to the host.

Применяется к

Дополнительно