Share via


ActivationArguments 類別

定義

為應用程式之資訊清單架構啟動過程提供資料。 此類別無法獲得繼承。

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
繼承
ActivationArguments
屬性

範例

下列程式代碼範例示範如何從 AppDomainSetup 指令清單型應用程式的 取得 AppDomain 目前的 ActivationArguments 物件。

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 類別。

以指令清單為基礎的啟用模型會使用應用程式指令清單,而不是用於啟用的元件。 指令清單會完整描述應用程式、其相依性、安全性需求等等。 指令清單模型對於元件型啟用模型有數個優點,特別是Web應用程式。 例如,指令清單包含應用程式的安全性需求,可讓用戶決定是否要在下載程式碼之前允許應用程式執行。 指令清單也包含應用程式相依性的相關信息。

建構函式

ActivationArguments(ActivationContext)

使用指定的啟動內容,初始化 ActivationArguments 類別的新執行個體。

ActivationArguments(ActivationContext, String[])

使用指定的啟動內容和啟動資料,初始化 ActivationArguments 類別的新執行個體。

ActivationArguments(ApplicationIdentity)

使用指定的應用程式識別 (Identity),初始化 ActivationArguments 類別的新執行個體。

ActivationArguments(ApplicationIdentity, String[])

使用指定的應用程式識別和啟動資料,初始化 ActivationArguments 類別的新執行個體。

屬性

ActivationContext

取得啟動內容,用於應用程式的資訊清單架構啟動過程。

ActivationData

取得主機的啟動資料。

ApplicationIdentity

取得應用程式識別,用於資訊清單啟動的應用程式。

方法

Clone()

產生目前 ActivationArguments 物件的複本。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於