XmlStreamStore.GetAnnotations メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ストア内のすべての注釈の一覧を返します。
オーバーロード
| 名前 | 説明 |
|---|---|
| GetAnnotations() |
ストア内のすべての注釈の一覧を返します。 |
| GetAnnotations(ContentLocator) |
一致するContentLocatorPart シーケンスで始まるロケーターでAnchors注釈の一覧を返します。 |
例
次の例は、 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)
一致するContentLocatorPart シーケンスで始まるロケーターでAnchors注釈の一覧を返します。
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 シーケンス。
返品
指定したanchorLocatorを開始して一致するロケーターを含むAnchors注釈の一覧。それ以外の場合は、一致する注釈が見つからなかった場合に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メソッドは、ContentLocator クラスのStartsWith メソッドを内部的に使用して、返される注釈を検索して照合します。