RunningPackage.InstanceID 属性

定义

返回与运行对象的此实例关联的唯一 ID。 此字段为只读。

public:
 property Guid InstanceID { Guid get(); };
public Guid InstanceID { get; }
member this.InstanceID : Guid
Public ReadOnly Property InstanceID As Guid

属性值

返回 GUID。

示例

下面的示例演示如何从对象中检索正在运行的Application包的集合,并循环访问每个包,并显示InstanceIDPackageIDPackageDescriptionPackageNameUserName

//...Declare and instantiate objects.  
//  
// Create a RunningPackages collection, pkgs, and fill it  
// with the running packages from the application object.  
RunningPackages pkgs = app.GetRunningPackages("yourserver");  
// Enumerate through each package in the collection and display some data.  
foreach(RunningPackage package in pkgs)  
    {  
        Console.WriteLine("InstanceID: "+package.InstanceID);  
        Console.WriteLine("PackageDescription: "+package.PackageDescription);  
        Console.WriteLine("PackageID: "+package.PackageID);  
        Console.WriteLine("PackageName: "+package.PackageName);  
        Console.WriteLine("UserName: "+package.UserName);  
    }  
//   more code here...  
'...Declare and instantiate objects.  
'  
' Create a RunningPackages collection, pkgs, and fill it  
' with the running packages from the application object.  
Dim pkgs As RunningPackages =  app.GetRunningPackages("yourserver")   
' Enumerate through each package in the collection and display some data.  
Dim package As RunningPackage  
For Each package In pkgs  
        Console.WriteLine("InstanceID: "+package.InstanceID)  
        Console.WriteLine("PackageDescription: "+package.PackageDescription)  
        Console.WriteLine("PackageID: "+package.PackageID)  
        Console.WriteLine("PackageName: "+package.PackageName)  
        Console.WriteLine("UserName: "+package.UserName)  
Next  
'   more code here...  

适用于