ViewDataDictionary<TModel> Constructors

Definition

Overloads

ViewDataDictionary<TModel>(ViewDataDictionary)

Initializes a new instance of the ViewDataDictionary<TModel> class based in part on an existing ViewDataDictionary instance.

ViewDataDictionary<TModel>(IModelMetadataProvider, ModelStateDictionary)

Initializes a new instance of the ViewDataDictionary<TModel> class.

ViewDataDictionary<TModel>(ViewDataDictionary, Object)

Initializes a new instance of the ViewDataDictionary<TModel> class based in part on an existing ViewDataDictionary instance. This constructor is careful to avoid exceptions SetModel(Object) may throw when model is null.

ViewDataDictionary<TModel>(ViewDataDictionary)

Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs

Initializes a new instance of the ViewDataDictionary<TModel> class based in part on an existing ViewDataDictionary instance.

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)

Parameters

source
ViewDataDictionary

ViewDataDictionary instance to copy initial values from.

Remarks

For use when copying a ViewDataDictionary instance and TModel is known but Model should be copied from the existing instance e.g. when copying from a base ViewDataDictionary instance to a ViewDataDictionary<TModel> instance.

This constructor may throw if source.Model is non-null and incompatible with TModel. Pass model: null to ViewDataDictionary<TModel>(ViewDataDictionary, Object) to ignore source.Model.

Applies to

ViewDataDictionary<TModel>(IModelMetadataProvider, ModelStateDictionary)

Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs

Initializes a new instance of the ViewDataDictionary<TModel> class.

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)

Parameters

metadataProvider
IModelMetadataProvider

IModelMetadataProvider instance used to create ModelExplorer instances.

modelState
ModelStateDictionary

ModelStateDictionary instance for this scope.

Remarks

For use when creating a ViewDataDictionary<TModel> for a new top-level scope.

Applies to

ViewDataDictionary<TModel>(ViewDataDictionary, Object)

Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs
Source:
ViewDataDictionaryOfT.cs

Initializes a new instance of the ViewDataDictionary<TModel> class based in part on an existing ViewDataDictionary instance. This constructor is careful to avoid exceptions SetModel(Object) may throw when model is null.

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)

Parameters

model
Object

Remarks

For use when copying a ViewDataDictionary instance and TModel and Model are known.

This constructor may throw if model is non-null and incompatible with TModel.

Applies to