次の方法で共有


ModulePageIdentifierAttribute.Guid プロパティ

定義

基本設定ストアで使用される識別子を取得します。

public:
 property Guid Guid { Guid get(); };
public Guid Guid { get; }
member this.Guid : Guid
Public ReadOnly Property Guid As Guid

プロパティ値

オブジェクトに関連付 ModulePage けられている GUID、または Empty GUID が基本設定ストアに存在しない場合は 。

次の例では、 オブジェクトを ModulePageIdentifierAttribute 作成し、 プロパティの値を Guid トレース リスナーに送信します。

protected override Guid PreferenceKey {
    get {
        object[] attrs = GetType().
            GetCustomAttributes(
            typeof(ModulePageIdentifierAttribute), 
            false);
        if (attrs.Length > 0) {
            ModulePageIdentifierAttribute
                modulePageIdentifierAttr = 
                (ModulePageIdentifierAttribute)attrs[0];
            return modulePageIdentifierAttr.Guid;
        }

        return Guid.Empty;
    }
} 

注釈

このメソッドをオーバーライドして、ページの状態に応じて異なる識別子を返すことができます。

適用対象