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

スレッド セーフ

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

参照

参照

LocalItemChange メンバー

Microsoft.Synchronization.SimpleProviders 名前空間