XmlStreamStore.GetAnnotations 메서드

정의

저장소의 모든 주석 목록을 반환합니다.

오버로드

Name Description
GetAnnotations()

저장소의 모든 주석 목록을 반환합니다.

GetAnnotations(ContentLocator)

일치하는 Anchors 시퀀스로 시작하는 로케이터가 있는 ContentLocatorPart 주석 목록을 반환합니다.

예제

다음 예제에서는 메서드를 사용 하 여 GetAnnotations 저장소에 포함 된 주석이 있는지 여부를 확인 하는 방법을 보여 줍니다.

// ---------------------------- CloseFile -----------------------------
private void CloseFile()
{
    // If there are existing annotations, then they should be saved.
    if (_annStore.GetAnnotations().Count > 0)
    {
        string backupFile = _fileName + ".annotations" + ".xml";
        FileStream backupStream = new FileStream(backupFile, FileMode.Create);
        CopyStream(_annotationBuffer, backupStream);
        _annStore.Flush();
        _annServ.Disable();
    }
}

GetAnnotations()

저장소의 모든 주석 목록을 반환합니다.

public:
 override System::Collections::Generic::IList<System::Windows::Annotations::Annotation ^> ^ GetAnnotations();
public override System.Collections.Generic.IList<System.Windows.Annotations.Annotation> GetAnnotations();
override this.GetAnnotations : unit -> System.Collections.Generic.IList<System.Windows.Annotations.Annotation>
Public Overrides Function GetAnnotations () As IList(Of Annotation)

반품

현재 저장소에 있는 모든 주석 목록입니다.

예외

Dispose 가 스토어에서 호출되었습니다.

예제

다음 예제에서는 메서드를 사용하여 저장소에 GetAnnotations 주석이 있는지 여부를 확인하는 방법을 보여 줍니다.

// ---------------------------- CloseFile -----------------------------
private void CloseFile()
{
    // If there are existing annotations, then they should be saved.
    if (_annStore.GetAnnotations().Count > 0)
    {
        string backupFile = _fileName + ".annotations" + ".xml";
        FileStream backupStream = new FileStream(backupFile, FileMode.Create);
        CopyStream(_annotationBuffer, backupStream);
        _annStore.Flush();
        _annServ.Disable();
    }
}

설명

메서드는 GetAnnotations 반환 null되지 않습니다. 그러나 저장소에 주석이 없는 경우 목록이 비어 있을 수 있습니다.

추가 정보

적용 대상

GetAnnotations(ContentLocator)

일치하는 Anchors 시퀀스로 시작하는 로케이터가 있는 ContentLocatorPart 주석 목록을 반환합니다.

public:
 override System::Collections::Generic::IList<System::Windows::Annotations::Annotation ^> ^ GetAnnotations(System::Windows::Annotations::ContentLocator ^ anchorLocator);
public override System.Collections.Generic.IList<System.Windows.Annotations.Annotation> GetAnnotations(System.Windows.Annotations.ContentLocator anchorLocator);
override this.GetAnnotations : System.Windows.Annotations.ContentLocator -> System.Collections.Generic.IList<System.Windows.Annotations.Annotation>
Public Overrides Function GetAnnotations (anchorLocator As ContentLocator) As IList(Of Annotation)

매개 변수

anchorLocator
ContentLocator

일치하는 주석을 반환할 시작 ContentLocatorPart 시퀀스입니다.

반품

지정된 Anchors주석을 시작하고 일치하는 로케이터가 있는 주석 anchorLocator 목록입니다. 그렇지 않으면 null 일치하는 주석을 찾을 수 없습니다.

예제

다음 예제에서는 메서드를 사용하여 저장소에 GetAnnotations 주석이 있는지 여부를 확인하는 방법을 보여 줍니다.

// ---------------------------- CloseFile -----------------------------
private void CloseFile()
{
    // If there are existing annotations, then they should be saved.
    if (_annStore.GetAnnotations().Count > 0)
    {
        string backupFile = _fileName + ".annotations" + ".xml";
        FileStream backupStream = new FileStream(backupFile, FileMode.Create);
        CopyStream(_annotationBuffer, backupStream);
        _annStore.Flush();
        _annServ.Disable();
    }
}

설명

GetAnnotations 메서드는 내부적으로 클래스의 StartsWith 메서드를 사용하여 ContentLocator 반환할 주석을 검색하고 일치합니다.

추가 정보

적용 대상