PersistenceModeAttribute 類別

定義

定義一個元資料屬性,指定如何在設計時將 ASP.NET 伺服器控制屬性或事件持久化到 ASP.NET 頁面。 此類別無法獲得繼承。

public ref class PersistenceModeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.All)]
public sealed class PersistenceModeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.All)>]
type PersistenceModeAttribute = class
    inherit Attribute
Public NotInheritable Class PersistenceModeAttribute
Inherits Attribute
繼承
PersistenceModeAttribute
屬性

範例

[PersistenceMode(PersistenceMode.InnerProperty),
TemplateContainer(typeof(TemplateItem))]
public ITemplate MessageTemplate {
   get {
      return _messageTemplate;
   }
   set {
      _messageTemplate = value;
   }
}

<PersistenceMode(PersistenceMode.InnerProperty), TemplateContainer(GetType(TemplateItem))> Public Property MessageTemplate() As ITemplate
   Get
      Return _messageTemplate
   End Get
   Set(ByVal Value As ITemplate)
      _messageTemplate = Value
   End Set
End Property

備註

欲了解更多屬性的使用資訊,請參閱屬性。

Note

Visual Studio 中的網頁設計器不支援由 Windows Forms 控制項可選擇性暴露的 ResetPropertyName 方法,以維持屬性持久性。 伺服器控制項會依類別 ControlPersister 提供的方法序列化。 這些方法的實作由中繼資料屬性驅動,如 DefaultValueAttributePersistenceModeAttributeDesignerSerializationVisibilityAttribute

建構函式

名稱 Description
PersistenceModeAttribute(PersistenceMode)

初始化 PersistenceModeAttribute 類別的新執行個體。

欄位

名稱 Description
Attribute

指定該屬性或事件能以屬性形式存留在伺服器控制項的開頭標籤中。 此欄位僅供讀取。

Default

指定類別的 PersistenceModeAttribute 預設類型。 預設值為 PersistenceMode.Attribute。 此欄位僅供讀取。

EncodedInnerDefaultProperty

指定屬性為 HTML 編碼,並作為 ASP.NET 伺服器控制項的唯一內部內容持續存在。 此欄位僅供讀取。

InnerDefaultProperty

指定一個屬性會持續存在為 ASP.NET 伺服器控制項的唯一內部內容。 此欄位僅供讀取。

InnerProperty

指定該屬性會以巢狀標籤的形式存在於伺服器控制的開啟與關閉標籤中。 此欄位僅供讀取。

屬性

名稱 Description
Mode

取得列舉的當前值 PersistenceMode

TypeId

在衍生類別中實作時,取得這個 Attribute的唯一標識碼。

(繼承來源 Attribute)

方法

名稱 Description
Equals(Object)

將該 PersistenceModeAttribute 物體與另一個物體進行比較。

GetHashCode()

提供屬性的 PersistenceModeAttribute 雜湊值。

GetType()

取得目前實例的 Type

(繼承來源 Object)
IsDefaultAttribute()

表示該 PersistenceModeAttribute 物件是否屬於預設類型。

Match(Object)

在衍生類別中覆寫時,傳回值,指出這個實例是否等於指定的物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

明確介面實作

名稱 Description
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取 物件的型別資訊,可用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開屬性和方法的存取權。

(繼承來源 Attribute)

適用於

另請參閱