共用方式為


SyncAgent.Synchronize 方法

同步處理本機與遠端資料存放區之間的資料。

命名空間: Microsoft.Synchronization
組件: Microsoft.Synchronization.Data (在 microsoft.synchronization.data.dll)

語法

'宣告
Public Function Synchronize As SyncStatistics
'用途
Dim instance As SyncAgent
Dim returnValue As SyncStatistics

returnValue = instance.Synchronize
public SyncStatistics Synchronize ()
public:
SyncStatistics^ Synchronize ()
public SyncStatistics Synchronize ()
public function Synchronize () : SyncStatistics

傳回值

包含同步處理工作階段之統計資料的 SyncStatistics 物件。

範例

下列程式碼範例會呼叫衍生自 SyncAgent 之類別的 Synchronize 方法,然後將資訊寫入主控台。若要在完整範例的內容中檢視這段程式碼,請參閱使用者入門:用戶端與伺服器同步處理

SampleSyncAgent sampleSyncAgent = new SampleSyncAgent();
SyncStatistics syncStatistics = sampleSyncAgent.Synchronize();
Console.WriteLine("Start Time: " + syncStatistics.SyncStartTime);
Console.WriteLine("Total Changes Downloaded: " + syncStatistics.TotalChangesDownloaded);
Console.WriteLine("Complete Time: " + syncStatistics.SyncCompleteTime);
Console.WriteLine(String.Empty);
Dim sampleSyncAgent As New SampleSyncAgent()
Dim syncStatistics As SyncStatistics = sampleSyncAgent.Synchronize()
Console.WriteLine("Start Time: " & syncStatistics.SyncStartTime)
Console.WriteLine("Total Changes Downloaded: " & syncStatistics.TotalChangesDownloaded)
Console.WriteLine("Complete Time: " & syncStatistics.SyncCompleteTime)
Console.WriteLine(String.Empty)

請參閱

參考

SyncAgent 類別
SyncAgent 成員
Microsoft.Synchronization 命名空間