HostProtectionAttribute.SelfAffectingProcessMgmt 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,表示是否公開影響自身的處理序管理。
public:
property bool SelfAffectingProcessMgmt { bool get(); void set(bool value); };
public bool SelfAffectingProcessMgmt { get; set; }
member this.SelfAffectingProcessMgmt : bool with get, set
Public Property SelfAffectingProcessMgmt As Boolean
屬性值
如果公開影響自身的處理序管理則為 true
,否則為 false
。 預設為 false
。
範例
下列程式代碼範例說明搭配 屬性SelfAffectingProcessMgmt使用 HostProtectionAttribute 屬性。 這個範例是提供給 類別之較大範例的 HostProtectionAttribute 一部分。
// 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
備註
自我影響進程管理程式碼可能會結束目前的進程,並終止伺服器。