ModulePage.PreferenceKey Property

Definition

Gets the identifier that is used in the preference store.

protected:
 virtual property Guid PreferenceKey { Guid get(); };
protected virtual Guid PreferenceKey { get; }
member this.PreferenceKey : Guid
Protected Overridable ReadOnly Property PreferenceKey As Guid

Property Value

A Guid identifier that is used in the preference store.

Examples

The following example demonstrates an overridden PreferenceKeyget accessor and sends the following output to the trace listener.

ModulePageIdentifierAttribute Guid = 0dbc1638-2ea4-1638-8785-ac716385b204

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;
    }
} 

Remarks

This property can be overridden to return different identifiers depending on the state of the page.

Applies to