共用方式為


ContextUtil.ApplicationInstanceId 屬性

定義

取得目前應用程式執行個體的 GUID。

public:
 static property Guid ApplicationInstanceId { Guid get(); };
public static Guid ApplicationInstanceId { get; }
static member ApplicationInstanceId : Guid
Public Shared ReadOnly Property ApplicationInstanceId As Guid

屬性值

目前應用程式執行個體的 GUID。

例外狀況

沒有 COM+ 內容可供使用。

平台不是 Windows XP 或更新版本。

範例

下列程式代碼範例會取得 屬性的值 ApplicationInstanceId

[Synchronization(SynchronizationOption::Required)]
public ref class ContextUtil_ApplicationInstanceId: public ServicedComponent
{
public:
   void Example()
   {
      // Display the ApplicationInstanceId associated with the current COM+
      // context.
      Console::WriteLine( "Application Instance ID: {0}", 
         ContextUtil::ApplicationInstanceId );
   }
};
[Synchronization(SynchronizationOption.Required)]
public class ContextUtil_ApplicationInstanceId : ServicedComponent
{
    public void Example()
    {
        // Display the ApplicationInstanceId associated with the current COM+
        // context.
        Console.WriteLine("Application Instance ID: {0}",
            ContextUtil.ApplicationInstanceId);
    }
}
<Synchronization(SynchronizationOption.Required)>  _
Public Class ContextUtil_ApplicationInstanceId
    Inherits ServicedComponent
    
    Public Sub Example() 
        ' Display the ApplicationInstanceId associated with the current COM+
        ' context.
        MsgBox("Application Instance ID: " & ContextUtil.ApplicationInstanceId.ToString())

    
    End Sub
End Class

適用於