ApplicationId ApplicationId ApplicationId ApplicationId Class


所含信息用于唯一标识基于清单的应用程序。Contains information used to uniquely identify a manifest-based application. 此类不能被继承。This class cannot be inherited.

public ref class ApplicationId sealed
public sealed class ApplicationId
type ApplicationId = class
Public NotInheritable Class ApplicationId


下面的代码示例通过使用ApplicationId ApplicationId ActivationContext为当前正在执行的基于ApplicationSecurityInfo清单的应用程序创建的实例获取, 来显示属性。The following code example displays the ApplicationId properties by obtaining the ApplicationId from an ApplicationSecurityInfo instance created using the ActivationContext for the currently executing manifest-based application.

using System;
using System.Collections;
using System.Text;
using System.Security.Policy;
using System.Reflection;
using System.Security;
using System.Security.Permissions;

namespace ActivationContextSample
    public class Program : MarshalByRefObject
        [SecurityPermission(SecurityAction.Demand, ControlDomainPolicy = true)]
        public static void Main(string[] args)
            Console.WriteLine("Full name = " +
            Console.WriteLine("Code base = " +
            ApplicationSecurityInfo asi = new ApplicationSecurityInfo(AppDomain.CurrentDomain.ActivationContext);

            Console.WriteLine("ApplicationId.Name property = " + asi.ApplicationId.Name);
            if (asi.ApplicationId.Culture != null)
                Console.WriteLine("ApplicationId.Culture property = " + asi.ApplicationId.Culture.ToString());
            Console.WriteLine("ApplicationId.ProcessorArchitecture property = " + asi.ApplicationId.ProcessorArchitecture);
            Console.WriteLine("ApplicationId.Version property = " + asi.ApplicationId.Version);
            // To display the value of the public key, enumerate the Byte array for the property.
            Console.Write("ApplicationId.PublicKeyToken property = ");
            byte[] pk = asi.ApplicationId.PublicKeyToken;
            for (int i = 0; i < pk.GetLength(0); i++)
                Console.Write("{0:x}", pk[i]);


        public void Run()
            Main(new string[] { });
Imports System.Collections
Imports System.Text
Imports System.Security.Policy
Imports System.Reflection
Imports System.Security
Imports System.Security.Permissions

Public Class Program
    Inherits MarshalByRefObject
    <SecurityPermission(SecurityAction.Demand, ControlDomainPolicy:=true)> _
    Public Shared Sub Main(ByVal args() As String) 
        Console.WriteLine("Full name = " + _
        Console.WriteLine("Code base = " + _
        Dim asi As New ApplicationSecurityInfo(AppDomain.CurrentDomain.ActivationContext)     
        Console.WriteLine("ApplicationId.Name property = " + asi.ApplicationId.Name)
        If Not (asi.ApplicationId.Culture Is Nothing) Then
            Console.WriteLine("ApplicationId.Culture property = " + _
        End If
        Console.WriteLine("ApplicationId.ProcessorArchitecture property = " + _
        Console.WriteLine("ApplicationId.Version property = " + _
        ' To display the value of the public key, enumerate the Byte array for the property.
        Console.Write("ApplicationId.PublicKeyToken property = ")
        Dim pk As Byte() = asi.ApplicationId.PublicKeyToken
        Dim i As Integer
        For i = 0 To (pk.GetLength(0))
            Console.Write("{0:x}", pk(i))
        Next i 
    End Sub
    Public Sub Run() 
        Main(New String() {})  
    End Sub
End Class


应用程序标识由发行者的公钥、应用程序名称、目标处理器体系结构、应用程序区域性和应用程序版本组成。An application identity consists of the publisher's public key, the application name, the target processor architecture, the application culture, and the application version. 应用程序标识属性值对应于应用程序清单中包含的信息。The application identity properties values correspond to information contained in the application manifest. 有关应用程序清单的详细信息, 请参阅ClickOnce 应用程序清单For more information about the application manifest, see ClickOnce Application Manifest.

ApplicationIdApplicationSecurityInfo类使用来标识基于清单的应用程序。ApplicationId is used by the ApplicationSecurityInfo class to identify a manifest-based application.


ApplicationId(Byte[], String, Version, String, String) ApplicationId(Byte[], String, Version, String, String) ApplicationId(Byte[], String, Version, String, String) ApplicationId(Byte[], String, Version, String, String)

初始化 ApplicationId 类的新实例。Initializes a new instance of the ApplicationId class.


Culture Culture Culture Culture

获取表示此应用程序的区域性信息的字符串。Gets a string representing the culture information for the application.

Name Name Name Name

获取应用程序的名称。Gets the name of the application.

ProcessorArchitecture ProcessorArchitecture ProcessorArchitecture ProcessorArchitecture

获取应用程序的目标处理器体系结构。Gets the target processor architecture for the application.

PublicKeyToken PublicKeyToken PublicKeyToken PublicKeyToken

获取应用程序的公钥标记。Gets the public key token for the application.

Version Version Version Version

获取应用程序的版本。Gets the version of the application.


Copy() Copy() Copy() Copy()

创建并返回当前应用程序标识的相同副本。Creates and returns an identical copy of the current application identity.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的 ApplicationId 对象是否等效于当前 ApplicationIdDetermines whether the specified ApplicationId object is equivalent to the current ApplicationId.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

获取当前应用程序标识的哈希代码。Gets the hash code for the current application identity.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

创建并返回应用程序标识的字符串表示。Creates and returns a string representation of the application identity.