ViewDataAttribute 類別

定義

裝飾的屬性 ViewDataAttribute 會將其值儲存在 中,並從 載入 ViewDataDictionaryViewDataDictionary 支援控制器的屬性和 Razor 頁面處理常式。

public ref class ViewDataAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
public sealed class ViewDataAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)>]
type ViewDataAttribute = class
    inherit Attribute
Public NotInheritable Class ViewDataAttribute
Inherits Attribute
繼承
ViewDataAttribute
屬性

建構函式

ViewDataAttribute()

裝飾的屬性 ViewDataAttribute 會將其值儲存在 中,並從 載入 ViewDataDictionaryViewDataDictionary 支援控制器的屬性和 Razor 頁面處理常式。

屬性

Key

取得或設定用來從 值 ViewDataDictionary 取得或新增屬性的索引鍵。 未指定時,索引鍵是屬性名稱。

適用於