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)

Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs
Source:
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> 实例时。

如果 为非null 且与 不兼容,则此构造函数可能throwTModelsource.Model 将 传递给 model: nullViewDataDictionary<TModel>(ViewDataDictionary, Object) 忽略 source.Model

适用于

ViewDataDictionary<TModel>(IModelMetadataProvider, ModelStateDictionary)

Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs
Source:
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)

Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs
Source:
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 是已知的。

如果 为非null 且与 不兼容,则此构造函数可能throwTModelmodel

适用于