XmlStreamStore.GetAnnotations Méthode

Définition

Retourne une liste de toutes les annotations dans le magasin.

Surcharges

Nom Description
GetAnnotations()

Retourne une liste de toutes les annotations dans le magasin.

GetAnnotations(ContentLocator)

Retourne une liste d’annotations dont les Anchors localisateurs commencent par une séquence correspondante ContentLocatorPart .

Exemples

L’exemple suivant montre comment utiliser la GetAnnotations méthode pour déterminer s’il existe des annotations contenues dans le magasin.

// ---------------------------- 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()

Retourne une liste de toutes les annotations dans le magasin.

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)

Retours

Liste de toutes les annotations actuellement présentes dans le magasin.

Exceptions

Dispose a été appelé sur le magasin.

Exemples

L’exemple suivant montre comment utiliser la GetAnnotations méthode pour déterminer s’il existe des annotations dans le magasin.

// ---------------------------- 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();
    }
}

Remarques

La GetAnnotations méthode ne retourne nulljamais ; toutefois, la liste peut être vide si le magasin ne contient aucune annotation.

Voir aussi

S’applique à

GetAnnotations(ContentLocator)

Retourne une liste d’annotations dont les Anchors localisateurs commencent par une séquence correspondante 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)

Paramètres

anchorLocator
ContentLocator

Séquence de départ ContentLocatorPart pour laquelle retourner les annotations correspondantes.

Retours

Liste des annotations qui ont Anchors des localisateurs qui démarrent et correspondent à l’élément donné anchorLocator; sinon, null si aucune annotation correspondante n’a été trouvée.

Exemples

L’exemple suivant montre comment utiliser la GetAnnotations méthode pour déterminer s’il existe des annotations dans le magasin.

// ---------------------------- 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();
    }
}

Remarques

Cette GetAnnotations méthode utilise en interne la StartsWith méthode de la ContentLocator classe pour rechercher et faire correspondre les annotations à retourner.

Voir aussi

S’applique à