SyncKnowledge::SetLocalTickCount Method
Sets the tick count for the replica that owns this knowledge.
Assembly: Microsoft.Synchronization (in Microsoft.Synchronization.dll)
| Exception | Condition |
|---|---|
| InvalidOperationException | This SyncKnowledge object is not initialized. |
The following example sets the tick count of the SyncKnowledge object to the local tick count before returning it to the caller.
Public Overrides Function GetKnowledge() As SyncKnowledge ' If the replica does not yet contain any knowledge, create a new knowledge object. If _knowledge Is Nothing Then _knowledge = New SyncKnowledge(IdFormats, ReplicaId, _tickCount) End If ' Ensure the tick count of the knowledge is set to the current tick count of the replica. _knowledge.SetLocalTickCount(_tickCount) Return _knowledge End Function
public override SyncKnowledge GetKnowledge() { // If the replica does not yet contain any knowledge, create a new knowledge object. if (null == _knowledge) { _knowledge = new SyncKnowledge(IdFormats, ReplicaId, _tickCount); } // Ensure the tick count of the knowledge is set to the current tick count of the replica. _knowledge.SetLocalTickCount(_tickCount); return _knowledge; }
Show: