Share via


SyncKnowledge.SetLocalTickCount Method

Sets the tick count for the replica that owns this knowledge.

Namespace: Microsoft.Synchronization
Assembly: Microsoft.Synchronization (in microsoft.synchronization.dll)

Syntax

'Declaration
Public Sub SetLocalTickCount ( _
    localTickCount As ULong _
)
'Usage
Dim instance As SyncKnowledge
Dim localTickCount As ULong

instance.SetLocalTickCount(localTickCount)
public void SetLocalTickCount (
    ulong localTickCount
)
public:
void SetLocalTickCount (
    usigned long long localTickCount
)
public void SetLocalTickCount (
    UInt64 localTickCount
)
public function SetLocalTickCount (
    localTickCount : ulong
)

Parameters

  • localTickCount
    The current tick count of the replica that owns this knowledge.

Remarks

The tick count must be current before the knowledge is sent to another replica. Typically, a provider calls this method immediately before sending its knowledge; although the method can be called at any time.

Example

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;
}

See Also

Reference

SyncKnowledge Class
SyncKnowledge Members
Microsoft.Synchronization Namespace