共用方式為


LocalItemChange 類別

表示對本機複寫中項目所做的變更,由 EnumerateChanges(array<Byte>[]()[][], AnchorEnumerationContext, array<Byte>[]()[][]%) 所傳回。

命名空間:  Microsoft.Synchronization.SimpleProviders
組件:  Microsoft.Synchronization.SimpleProviders (在 Microsoft.Synchronization.SimpleProviders.dll 中)

語法

'宣告
Public Class LocalItemChange
'用途
Dim instance As LocalItemChange
public class LocalItemChange
public ref class LocalItemChange
type LocalItemChange =  class end
public class LocalItemChange

範例

下列程式碼範例針對將項目儲存在記憶體中存放區的範例應用程式示範 EnumerateChanges 方法的實作。LocalItemChange 物件是用來儲存此存放區中自上次錨定後已經變更的每一個項目的變更。若要在完整應用程式的內容中檢視這段程式碼,請參閱 Sync Framework SDK 及 Code Gallery 中的 "Sync101 using Simple Sync Provider" 應用程式。

public override void EnumerateChanges(byte[] anchor, AnchorEnumerationContext context)
{
    List<LocalItemChange> itemChanges = new List<LocalItemChange>();

    int startIndex = -1;

    if (anchor != null)
    {
        startIndex = _store.Changes.IndexOfKey(BitConverter.ToUInt64(anchor, 0));
    }

    for (int i = startIndex + 1; i < _store.Changes.Count; i++)
    {
        itemChanges.Add(_store.Changes.Values[i]);
    }

    // If the anchor is corrupt or out of date we could revert back to 
    // full enumeration mode for this session, and enumerate all items. 
    // This is done by calling context.ReportItemsAndAutodetectDeletes.
    context.ReportChanges(itemChanges, _store.GetAnchor());
}
Public Overrides Sub EnumerateChanges(ByVal anchor As Byte(), ByVal context As AnchorEnumerationContext)
    Dim itemChanges As New List(Of LocalItemChange)()

    Dim startIndex As Integer = -1

    If anchor IsNot Nothing Then
        startIndex = _store.Changes.IndexOfKey(BitConverter.ToUInt64(anchor, 0))
    End If

    For i As Integer = startIndex + 1 To _store.Changes.Count - 1
        itemChanges.Add(_store.Changes.Values(i))
    Next

    ' If the anchor is corrupt or out of date we could revert back to 
    ' full enumeration mode for this session, and enumerate all items. 
    ' This is done by calling context.ReportItemsAndAutodetectDeletes. 
    context.ReportChanges(itemChanges, _store.GetAnchor())
End Sub

繼承階層

System. . :: . .Object
  Microsoft.Synchronization.SimpleProviders..::..LocalItemChange

執行緒安全性

這個類型的任何公用static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。不保證任何執行個體成員都可以是安全執行緒。

請參閱

參考

LocalItemChange 成員

Microsoft.Synchronization.SimpleProviders 命名空間