ActivationArguments 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为应用程序的基于清单的激活提供数据。 此类不能被继承。
public ref class ActivationArguments sealedpublic 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 EvidenceBasePublic NotInheritable Class ActivationArgumentsPublic NotInheritable Class ActivationArguments
Inherits EvidenceBase- 继承
- 
				ActivationArguments
- 继承
- 属性
示例
下面的代码示例演示如何从AppDomainSetupAppDomain基于清单的应用程序的 的 获取当前 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) | 使用指定的应用程序标识初始化 ActivationArguments 类的新实例。 | 
| ActivationArguments(ApplicationIdentity, String[]) | 用指定的应用程序标识和激活数据初始化 ActivationArguments 类的新实例。 | 
属性
| ActivationContext | 为应用程序获取基于清单的激活的激活上下文。 | 
| ActivationData | 从宿主获取激活数据。 | 
| ApplicationIdentity | 为清单激活的应用程序获取应用程序标识。 | 
方法
| Clone() | 生成当前 ActivationArguments 对象的副本。 | 
| Equals(Object) | 确定指定对象是否等于当前对象。(继承自 Object) | 
| GetHashCode() | 作为默认哈希函数。(继承自 Object) | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| ToString() | 返回表示当前对象的字符串。(继承自 Object) |