ReportChanges メソッド

EnumerateChanges の呼び出し中に取得された一連の変更を報告します。

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

構文

'宣言
Public Sub ReportChanges ( _
    itemChanges As IEnumerable(Of LocalItemChange), _
    updatedAnchor As Byte() _
)
'使用
Dim instance As AnchorEnumerationContext
Dim itemChanges As IEnumerable(Of LocalItemChange)
Dim updatedAnchor As Byte()

instance.ReportChanges(itemChanges, updatedAnchor)
public void ReportChanges(
    IEnumerable<LocalItemChange> itemChanges,
    byte[] updatedAnchor
)
public:
void ReportChanges(
    IEnumerable<LocalItemChange^>^ itemChanges, 
    array<unsigned char>^ updatedAnchor
)
member ReportChanges : 
        itemChanges:IEnumerable<LocalItemChange> * 
        updatedAnchor:byte[] -> unit 
public function ReportChanges(
    itemChanges : IEnumerable<LocalItemChange>, 
    updatedAnchor : byte[]
)

パラメーター

  • updatedAnchor
    型 : array<System. . :: . .Byte> [] () [] []
    列挙アンカー (タイムスタンプなど) を表すバイト配列。

例外

例外 条件
SimpleProviderInvalidOperationException

ReportItemsAndAutodetectDeletes は同じセッションで呼び出されました。

次のコード例では、EnumerateChanges メソッドに渡される AnchorEnumerationContext オブジェクト、およびコンテキスト オブジェクトで呼び出される ReportChanges メソッドを示します。完全なアプリケーションのコンテキストでこのコードを表示するには、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

参照

参照

AnchorEnumerationContextクラス

AnchorEnumerationContext メンバー

Microsoft.Synchronization.SimpleProviders 名前空間