ActivationContext Class

Definition

Identifies the activation context for the current application. This class cannot be inherited.

[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
public sealed class ActivationContext : IDisposable, System.Runtime.Serialization.ISerializable
Inheritance
ActivationContext
Attributes
Implements

Examples

The following code example demonstrates the use of an ActivationContext object to obtain the ApplicationIdentity for a manifest-based application. For correct results, execute this code example as a manifest-based application.

using System;

namespace ActivationContextSample
{
    public class Program : MarshalByRefObject
    {
        public static void Main(string[] args)
        {
            ActivationContext ac = AppDomain.CurrentDomain.ActivationContext;
            ApplicationIdentity ai = ac.Identity;
            Console.WriteLine("Full name = " + ai.FullName);
            Console.WriteLine("Code base = " + ai.CodeBase);

            Console.Read();
        }

        public void Run()
        {
            Main(new string[] { });
            Console.ReadLine();
        }
    }
}

Remarks

The ActivationContext class contains an ApplicationIdentity and provides internal-only access to the application manifest. The activation context is used during manifest-based activation to set up the domain policy and provide an application-based security model. For more information, see the ApplicationSecurityManager class.

Importante

This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

Properties

ApplicationManifestBytes

Gets the ClickOnce application manifest for the current application.

DeploymentManifestBytes

Gets the ClickOnce deployment manifest for the current application.

Form

Gets the form, or store context, for the current application.

Identity

Gets the application identity for the current application.

Methods

CreatePartialActivationContext(ApplicationIdentity, String[])

Initializes a new instance of the ActivationContext class using the specified application identity and array of manifest paths.

CreatePartialActivationContext(ApplicationIdentity)

Initializes a new instance of the ActivationContext class using the specified application identity.

Dispose()

Releases all resources used by the ActivationContext.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize()

Enables an ActivationContext object to attempt to free resources and perform other cleanup operations before the ActivationContext is reclaimed by garbage collection.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

Populates a SerializationInfo with the data needed to serialize the target object.

Applies to

Prodotto Versioni
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also