PeerApplication 類別


代表可與對等共同作業基礎結構一起使用的應用程式。Represents an application that is available for use with the Peer Collaboration infrastructure.

public ref class PeerApplication : IDisposable, IEquatable<System::Net::PeerToPeer::Collaboration::PeerApplication ^>, System::Runtime::Serialization::ISerializable
public class PeerApplication : IDisposable, IEquatable<System.Net.PeerToPeer.Collaboration.PeerApplication>, System.Runtime.Serialization.ISerializable
type PeerApplication = class
    interface IDisposable
    interface IEquatable<PeerApplication>
    interface ISerializable
Public Class PeerApplication
Implements IDisposable, IEquatable(Of PeerApplication), ISerializable


應用程式是一組可供端點的對等使用的軟體或軟體功能。An application is a set of software or software features available to a peer from an endpoint. 這通常是指已啟用網路功能的軟體套件, 例如遊戲或其他共同作業應用程式。Commonly, this refers to network-enabled software packages such as games or other collaborative applications. 會定義一組可PeerCollaboration與網路搭配使用的軟體應用程式或元件。 PeerApplicationA PeerApplication defines the set of software applications or components available for use with the PeerCollaboration network. 此網路可讓基礎結構參與者起始此應用程式的使用。This network enables infrastructure participants to initiate usage of this application. 他們可以使用此類別所識別的應用程式來起始共同作業會話。They may initiate a collaboration session using the application identified by this class.

在您建立這個類別的實例並設定適當的屬性之後, 這個物件可能會用於System.Net.PeerToPeer共同作業會話中。After constructing an instance of this class and setting the appropriate properties, this object may be used in System.Net.PeerToPeer collaboration sessions. 其使用方式是將它傳遞給對等RegisterApplication共同作業和UnregisterApplication方法, 這會啟用或停用它。Its use is accomplished by passing it to the peer collaboration RegisterApplication and UnregisterApplication methods, which will enable or disable it.

您必須先Id設定PeerApplicationRegistrationType這個實例的全域唯一和屬性, 才能成功註冊應用程式。The globally unique Id and PeerApplicationRegistrationType properties of this instance must be set before the application can successfully be registered.

向對等共同作業基礎結構註冊應用程式之後, 註冊資訊會保留在登錄中。After registering an application with the Peer Collaboration infrastructure, the registration information persists in the registry. 這讓應用程式可用於共同作業應用程式, 即使在註冊應用程式的程式結束後也是如此。This makes the application available to collaboration applications even after the program which registered the application has exited.

在應用程式實例註冊之後變更其屬性並不會影響註冊。Changing the properties on an application instance after it has been registered has no effect on the registration. 若要更新註冊, 必須取消註冊應用程式, 然後以新資訊重新註冊。To update the registration, the application must be unregistered and then registered again with the new information.



初始化 PeerApplication 型別預設的新執行個體。Initializes a new default instance of the PeerApplication type.

PeerApplication(Guid, String, Byte[], String, String, PeerScope)

使用提供的應用程式 ID、描述、範圍和資料項目初始化新的 PeerApplication 執行個體。Initializes a new PeerApplication instance with the supplied application ID, description, scope, and data elements.

PeerApplication(SerializationInfo, StreamingContext)

使用序列化所需的資料初始化 PeerApplication 類型的新執行個體。Initializes a new instance of the PeerApplication type with the data required for serialization.



取得或設定在啟動 PeerApplication 時要使用的命令列參數。Gets or sets command-line parameters to use when initiating a PeerApplication.


取得或設定與目前 PeerApplication 執行個體相關聯的資料。Gets or sets data associated with the current PeerApplication instance.


取得或設定描述 String 的 Unicode PeerApplicationGets or sets a Unicode String that describes the PeerApplication.


取得或設定與 Guid 相關聯的使用者定義 PeerApplicationGets or sets the user-defined Guid associated with the PeerApplication.


取得或設定路徑,指定 PeerApplication 可執行檔位於本機檔案系統的位置。Gets or sets the path that designates where the PeerApplication executable file resides on the local file system.


取得或設定 PeerApplication 的註冊範圍,以進行共同作業。Gets or sets the scope in which the PeerApplication is registered for collaboration.


當屬性值設定後,因非同步作業而未引發的所有事件都會有建立該特定 SynchronizingObject 之執行緒上回呼的相關事件處理常式。When this property value is set, all events not fired as the result of an asynchronous operation will have the associated event handlers called back on the thread that created the specific SynchronizingObject.



釋放由 PeerApplication 物件使用的資源。Releases resources used by the PeerApplication object.


釋放 PeerApplication 物件所使用的 Unmanaged 資源,並選擇性釋放 Managed 資源。Releases the unmanaged resources used by the PeerApplication object and optionally releases the managed resources.


比較 PeerApplication 和指定的 ObjectCompares the PeerApplication to the specified Object.

Equals(Object, Object)

判斷指定的 PeerApplication 物件是否視為相等。Determines whether the specified PeerApplication objects are considered equal.


比較 PeerApplication 和指定的 PeerApplication 執行個體。Compares the PeerApplication to the specified PeerApplication instance.


傳回 PeerApplication 執行個體的雜湊程式碼。Returns the hash code for a PeerApplication instance.

GetObjectData(SerializationInfo, StreamingContext)

將序列化目標 PeerApplication所需的資料填入 SerializationInfoPopulates a SerializationInfo with the data needed to serialize the target PeerApplication.


取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)

引發 ApplicationChanged 事件。Raises the ApplicationChanged event.


傳回字串,其中包含 Id 執行個體的 DescriptionPeerApplicationReturns a string that contains the Id and Description of the PeerApplication instance.



當訂閱的端點上的遠端對等電腦加入、更新或刪除 PeerApplication 時,就會引發這個事件。This event is raised whenever a PeerApplication is added, updated or deleted by a remote peer on a subscribed endpoint.


ISerializable.GetObjectData(SerializationInfo, StreamingContext)

實作 ISerializable 介面,並傳回將 PeerApplication 目標序列化所需的資料。Implements the ISerializable interface and returns the data required to serialize the target PeerApplication.