LocalItemChange クラス

EnumerateChanges によって返されたローカル レプリカの項目に対する変更を表します。

名前空間: Microsoft.Synchronization.SimpleProviders
アセンブリ: Microsoft.Synchronization.SimpleProviders (microsoft.synchronization.simpleproviders.dll 内)

構文

'宣言
Public Class LocalItemChange
'使用
Dim instance As LocalItemChange
public class LocalItemChange
public ref class LocalItemChange
public class LocalItemChange
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

スレッド セーフ

この型の public static (Visual Basic では Shared ) メンバーはすべて、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

参照

リファレンス

LocalItemChange メンバー
Microsoft.Synchronization.SimpleProviders 名前空間