共用方式為


ViewDataDictionary<TModel> 建構函式

定義

多載

ViewDataDictionary<TModel>(ViewDataDictionary)

根據現有的 ViewDataDictionary 實例,初始化 類別的新實例 ViewDataDictionary<TModel>

ViewDataDictionary<TModel>(IModelMetadataProvider, ModelStateDictionary)

初始化 ViewDataDictionary<TModel> 類別的新執行個體。

ViewDataDictionary<TModel>(ViewDataDictionary, Object)

根據現有的 ViewDataDictionary 實例,初始化 類別的新實例 ViewDataDictionary<TModel> 。 這個建構函式會小心避免在 為 nullmodel 擲回例外狀況 SetModel(Object)

ViewDataDictionary<TModel>(ViewDataDictionary)

來源:
ViewDataDictionaryOfT.cs
來源:
ViewDataDictionaryOfT.cs
來源:
ViewDataDictionaryOfT.cs

根據現有的 ViewDataDictionary 實例,初始化 類別的新實例 ViewDataDictionary<TModel>

public:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source);
public ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<'Model> : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<'Model>
Public Sub New (source As ViewDataDictionary)

參數

source
ViewDataDictionary

ViewDataDictionary 要從中複製初始值的 實例。

備註

用於複製 ViewDataDictionary 實例且 TModel 已知,但 Model 應該從現有的實例複製,例如從基底 ViewDataDictionary 實例 ViewDataDictionary<TModel> 複製到實例時。

如果 source.Model 不是 且 null 與 不相容,則此建構函式可能會 throwTModel 。 傳遞 model: nullViewDataDictionary<TModel>(ViewDataDictionary, Object) 以忽略 source.Model

適用於

ViewDataDictionary<TModel>(IModelMetadataProvider, ModelStateDictionary)

來源:
ViewDataDictionaryOfT.cs
來源:
ViewDataDictionaryOfT.cs
來源:
ViewDataDictionaryOfT.cs

初始化 ViewDataDictionary<TModel> 類別的新執行個體。

public:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ModelBinding::IModelMetadataProvider ^ metadataProvider, Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateDictionary ^ modelState);
public ViewDataDictionary (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<'Model> : Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider * Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<'Model>
Public Sub New (metadataProvider As IModelMetadataProvider, modelState As ModelStateDictionary)

參數

metadataProvider
IModelMetadataProvider

IModelMetadataProvider 用來建立 ModelExplorer 實例的 實例。

modelState
ModelStateDictionary

ModelStateDictionary 這個範圍的 實例。

備註

用於建立 ViewDataDictionary<TModel> 新最上層範圍的 。

適用於

ViewDataDictionary<TModel>(ViewDataDictionary, Object)

來源:
ViewDataDictionaryOfT.cs
來源:
ViewDataDictionaryOfT.cs
來源:
ViewDataDictionaryOfT.cs

根據現有的 ViewDataDictionary 實例,初始化 類別的新實例 ViewDataDictionary<TModel> 。 這個建構函式會小心避免在 為 nullmodel 擲回例外狀況 SetModel(Object)

public:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source, System::Object ^ model);
public ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, object model);
public ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, object? model);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<'Model> : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary * obj -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary<'Model>
Public Sub New (source As ViewDataDictionary, model As Object)

參數

model
Object

備註

用於複製 ViewDataDictionary 實例和 和 TModelModel 時為已知。

如果 model 不是 且 null 與 不相容,則此建構函式可能會 throwTModel

適用於