SyncKnowledge.SetLocalTickCount 方法
设置具有此知识的副本的滴答计数。
命名空间: Microsoft.Synchronization
程序集: Microsoft.Synchronization(在 microsoft.synchronization.dll 中)
语法
声明
Public Sub SetLocalTickCount ( _
localTickCount As ULong _
)
用法
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
)
参数
- localTickCount
具有此知识的副本的当前滴答计数。
备注
在向另一副本发送此知识之前,滴答计数必须为当前滴答计数。虽然此方法可以随时调用,但是,通常情况下,提供程序在发送其知识的前一时刻才会调用此方法。
示例
下面的示例将 SyncKnowledge 对象的滴答计数设置为本地滴答计数,然后再返回给调用方。
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;
}
请参阅
参考
SyncKnowledge 类
SyncKnowledge 成员
Microsoft.Synchronization 命名空间