ActivationArguments 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供基於清單啟動應用程式的資料。 此類別無法獲得繼承。
public ref class ActivationArguments sealed
public ref class ActivationArguments sealed : System::Security::Policy::EvidenceBase
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class ActivationArguments
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class ActivationArguments : System.Security.Policy.EvidenceBase
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type ActivationArguments = class
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type ActivationArguments = class
inherit EvidenceBase
Public NotInheritable Class ActivationArguments
Public NotInheritable Class ActivationArguments
Inherits EvidenceBase
- 繼承
-
ActivationArguments
- 繼承
- 屬性
範例
以下程式碼範例展示了如何從 for ActivationArgumentsAppDomainSetup 取得 manifest 應用程式的當前AppDomain物件。
using System;
using System.Collections;
using System.Text;
using System.Security.Policy;
using System.Reflection;
using System.Security;
using System.Runtime.Hosting;
namespace ActivationContextSample
{
public class Program : MarshalByRefObject
{
public static void Main(string[] args)
{
// Get the AppDomainManager from the current domain.
AppDomainManager domainMgr = AppDomain.CurrentDomain.DomainManager;
// Get the ApplicationActivator from the AppDomainManager.
ApplicationActivator appActivator = domainMgr.ApplicationActivator;
Console.WriteLine("Assembly qualified name from the application activator.");
Console.WriteLine(appActivator.GetType().AssemblyQualifiedName);
// Get the ActivationArguments from the SetupInformation property of the domain.
ActivationArguments activationArgs = AppDomain.CurrentDomain.SetupInformation.ActivationArguments;
// Get the ActivationContext from the ActivationArguments.
ActivationContext actContext = activationArgs.ActivationContext;
Console.WriteLine("The ActivationContext.Form property value is: " +
activationArgs.ActivationContext.Form);
Console.Read();
}
public void Run()
{
Main(new string[] { });
Console.ReadLine();
}
}
}
Imports System.Collections
Imports System.Text
Imports System.Security.Policy
Imports System.Reflection
Imports System.Security
Imports System.Security.Permissions
Imports System.Runtime.Hosting
Public Class Program
Inherits MarshalByRefObject
<SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy:=True)> _
Public Shared Sub Main(ByVal args() As String)
' Get the AppDomainManager from the current domain.
Dim domainMgr As AppDomainManager = AppDomain.CurrentDomain.DomainManager
' Get the ApplicationActivator from the AppDomainManager.
Dim appActivator As ApplicationActivator = domainMgr.ApplicationActivator
Console.WriteLine("Assembly qualified name from the application activator.")
Console.WriteLine(appActivator.GetType().AssemblyQualifiedName)
Dim ac As ActivationContext = AppDomain.CurrentDomain.ActivationContext
' Get the ActivationArguments from the SetupInformation property of the domain.
Dim activationArgs As ActivationArguments = AppDomain.CurrentDomain.SetupInformation.ActivationArguments
' Get the ActivationContext from the ActivationArguments.
Dim actContext As ActivationContext = activationArgs.ActivationContext
Console.WriteLine("The ActivationContext.Form property value is: " + _
activationArgs.ActivationContext.Form.ToString())
Console.Read()
End Sub
<SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy:=True)> _
Public Sub Run()
Main(New String() {})
Console.ReadLine()
End Sub
End Class
備註
ActivationArguments該類別由該類別使用AppDomainSetup。
基於清單的啟動模型使用應用程式清單而非組裝裝置來啟動。 清單完整描述應用程式、其相依性、安全需求等。 清單模型相較於組語言組的啟動模型有多項優勢,尤其適用於網頁應用程式。 例如,清單包含應用程式的安全需求,讓使用者能決定是否允許應用程式執行後再下載程式碼。 清單中也包含應用程式相依性的資訊。
建構函式
| 名稱 | Description |
|---|---|
| ActivationArguments(ActivationContext, String[]) |
初始化一個新的類別實例 ActivationArguments ,並依照指定的啟動上下文與啟用資料。 |
| ActivationArguments(ActivationContext) |
初始化一個以指定啟動上下文的新類別實例 ActivationArguments 。 |
| ActivationArguments(ApplicationIdentity, String[]) |
初始化一個包含指定應用程式身份與啟用資料的新類別實例 ActivationArguments 。 |
| ActivationArguments(ApplicationIdentity) |
初始化一個以指定應用程式身份的新類別實例 ActivationArguments 。 |
屬性
| 名稱 | Description |
|---|---|
| ActivationContext |
取得應用程式基於manifest啟動的啟動上下文。 |
| ActivationData |
從主機取得啟動資料。 |
| ApplicationIdentity |
取得已啟用清單的應用程式身份。 |
方法
| 名稱 | Description |
|---|---|
| Clone() |
產生當前 ActivationArguments 物件的副本。 |
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |