PeerCollaboration.SetObject(PeerObject) 方法

定義

註冊與呼叫對等相關聯的 PeerObjectRegisters a PeerObject associated with the calling peer.

public:
 static void SetObject(System::Net::PeerToPeer::Collaboration::PeerObject ^ peerObject);
[System.Security.SecurityCritical]
public static void SetObject (System.Net.PeerToPeer.Collaboration.PeerObject peerObject);
[<System.Security.SecurityCritical>]
static member SetObject : System.Net.PeerToPeer.Collaboration.PeerObject -> unit
Public Shared Sub SetObject (peerObject As PeerObject)

參數

peerObject
PeerObject

要註冊的 PeerObjectThe PeerObject to register.

屬性

例外狀況

物件已註冊Object already registered

- PeerObject 不可以是 null- PeerObject cannot be null.

  • Id 不可以是 null
  • Id cannot be null.
  • SetObject(PeerObject) 作業無法完成。The SetObject(PeerObject) operation could not be completed.

    備註

    這個方法可讓參與已註冊物件之範圍的遠端對等,查詢物件。This method allows the object to be queried by remote peers participating in the scope in which the object was registered. 如果先前已註冊物件,這個方法會更新其註冊。If the object was previously registered, this method updates its registration. 如果已註冊的物件超出範圍,則可透過 GetLocalSetObjects 方法抓取。If a registered object falls out of scope, it can be retrieved via the GetLocalSetObjects method.

    的資料部分大小 PeerObject 必須小於或等於16384個位元組。The size of the data portion of the PeerObject must be less than or equal to 16,384 bytes.

    存取這個方法需要 PermissionStateUnrestrictedAccess to this method requires a PermissionState of Unrestricted. 此狀態會在共同 Peer 作業會話開始時建立。This state is created when the Peer collaboration session begins.

    適用於

    另請參閱