共用方式為


WebPart.ShouldSerializeAllowHide method

會傳回AllowHide屬性是否有所變更其預設值。

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public Overridable Function ShouldSerializeAllowHide As Boolean
'用途
Dim instance As WebPart
Dim returnValue As Boolean

returnValue = instance.ShouldSerializeAllowHide()
public virtual bool ShouldSerializeAllowHide()

傳回值

Type: System.Boolean
true屬性已變更,預設值 ;否則,請false.

備註

由於AllowHide屬性沒有簡單的預設值,會提供ShouldSerializeAllowHide方法。此方法會指出屬性是否有所變更其預設值。您通常叫用這個方法開發 designer WebPart類別,或建立您自己的網頁組件或工具組件時,讓您可以避免整天保存的預設值。

如果您覆寫此函數,請將您的函數應傳回true ,如果已從其預設值變更對應的屬性或SerializeAll屬性為true。例如:

public override bool ShouldSerializeAllowHide()
{
    return SerializeAll || defaultAllowHide != _allowHide;
}

請參閱

參照

WebPart class

WebPart members

Microsoft.SharePoint.WebPartPages namespace