다음을 통해 공유


LocalItemChange 클래스

EnumerateChanges가 반환하는 로컬 복제본의 항목에 대한 변경 내용을 나타냅니다.

네임스페이스: Microsoft.Synchronization.SimpleProviders
어셈블리: microsoft.synchronization.simpleproviders.dll의 Microsoft.Synchronization.SimpleProviders

구문

‘선언
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 네임스페이스