PeerObject 类


表示 PeerObject 类的一个新实例,此实例具有自动生成的 GuidRepresents a new instance of the PeerObject class with an auto-generated Guid.

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


PeerObject 是运行时数据,如图片、证书或与特定应用程序关联的特定说明。A PeerObject is run-time data, such as a picture, certificate, or a specific description that is associated with a particular application. 每个 PeerObject 实例的数据元素的大小必须小于或等于16KB。The data element of each PeerObject instance must be less than or equal to 16KB in size. 构造 PeerObject 的实例后,将通过对等方协作基础结构发布它 SetObjectAfter an instance of PeerObject is constructed it is published with the Peer Collaboration Infrastructure via SetObject.

构造此类的实例并设置相应的属性后,可以将此对象传递到 PeerCollaboration SetObjectDeleteObject 方法,以启用/禁用此对象的发布,以供其他对等节点发现和查看。After constructing an instance of this class and setting the appropriate properties this object may be passed to the PeerCollaborationSetObject and DeleteObject methods to enable/disable the publishing of this object for other peers to discover and view.

在将对象注册到协作基础结构后,注册表中不会保存注册信息,这会导致来自实例的行为不同 PeerApplicationAfter registering an object with the collaboration infrastructure the registration information is not persisted in the registry, resulting in different behavior from PeerApplication instances. 对象注册仅在注册了对象的应用程序的生存期内有效。The object registration is only valid for the lifetime duration of the application which registered the object. 当不再需要或在应用程序退出之前,应用程序应取消注册对象。Applications should unregister objects when they are no longer required or prior to application exit. 默认情况下,如果实例超出范围,PeerObject 将自动取消注册。By default, a PeerObject is automatically unregistered if the instance goes out of scope.

使用注册方法在 PeerObject 实例上更改属性后, PeerCollaboration 将不会更新 PeerObject 实例的注册。Changing the properties on a PeerObject instance after it has been registered using the PeerCollaboration registration methods will not update the registration for the PeerObject instance. 若要有效地更新特定 PeerObject 实例的注册,必须使用新信息重新删除并注册 PeerObject。To effectively update the registration of a specific PeerObject instance, the PeerObject must be deleted and registered again with the new information.



初始化 PeerObject 类的新默认实例。Initializes a new default instance of the PeerObject class.

PeerObject(Guid, Byte[], PeerScope)

使用关联的范围和数据初始化一个新的 PeerObject 实例。Initializes a new PeerObject instance with the associated scope and data.

PeerObject(SerializationInfo, StreamingContext)

使用序列化所需的关联参数初始化一个新的 PeerObject 实例。Initializes a new PeerObject instance with the associated parameters required for serialization.



获取或设置与对等方协作基础结构的 PeerObject 实例关联的描述性数据。Gets or sets descriptive data associated with the PeerObject instance for a Peer Collaboration application.


获取或设置一个与 Guid 实例关联的 PeerObjectGets or sets a Guid associated with the PeerObject instance.


获取或设置要在其中注册 PeerScope 实例的 PeerObjectGets or sets the PeerScope in which the PeerObject instance is registered.


获取或设置用于封送因 PeerObject 实例更改而发出的事件处理程序调用的对象。Gets or sets the object used to marshal the event handler calls that are issued as a result of a PeerObject instance change.



释放由 PeerObject 利用的所有资源。Releases all resources utilized by the PeerObject.


释放由 PeerObject 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources used by the PeerObject and optionally releases the managed resources.


PeerObject 与指定的对象进行比较。Compares the PeerObject to the specified object.

Equals(Object, Object)

确定指定的 PeerObject 实例是否可视为相等的实例。Determines whether the specified PeerObject instances are considered equal.


PeerObject 与指定的 PeerObject 实例进行比较。Compares a PeerObject to the specified PeerObject instance.


返回 PeerObject 实例的哈希代码。Returns the hash code for the PeerObject instance.

GetObjectData(SerializationInfo, StreamingContext)

使用序列化指定的 SerializationInfo 所需的数据填充 PeerObjectPopulates a SerializationInfo with the data required to serialize the specified PeerObject.


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

(继承自 Object)

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

(继承自 Object)

在远程对等方添加、更新或移除具有指定 ID 的 PeerObject 实例时发出信号。Signaled when a PeerObject instance with the specified ID is added, updated or removed by a remote peer.


返回表示 PeerObject 实例的 StringReturns a String that represents a PeerObject instance.



PeerObject 实例更改时发出信号。Signaled when a PeerObject instance changes.


ISerializable.GetObjectData(SerializationInfo, StreamingContext)

使用从已序列化的源中获取的数据填充当前的 PeerObject 实例。Populates the current PeerObject instance with the data obtained from the serialized source.