ViewDataDictionary Constructors

Definition

Overloads

ViewDataDictionary(ViewDataDictionary)

Initializes a new instance of the ViewDataDictionary class based entirely on an existing instance.

ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary)

Initializes a new instance of the ViewDataDictionary class.

ViewDataDictionary(IModelMetadataProvider, Type)

Initializes a new instance of the ViewDataDictionary class.

ViewDataDictionary(ViewDataDictionary, Type)

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

ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary, Type)

Initializes a new instance of the ViewDataDictionary class.

ViewDataDictionary(ViewDataDictionary, Object, Type)

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

ViewDataDictionary(ViewDataDictionary)

Source:
ViewDataDictionary.cs
Source:
ViewDataDictionary.cs

Initializes a new instance of the ViewDataDictionary class based entirely on an existing instance.

public:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source);
public ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
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 the declared ModelType will not change e.g. when copying from a ViewDataDictionary<TModel> instance to a base ViewDataDictionary instance.

This constructor should not be used in any context where Model may be set to a value incompatible with the declared type of source.

Applies to

ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary)

Source:
ViewDataDictionary.cs
Source:
ViewDataDictionary.cs

Initializes a new instance of the ViewDataDictionary 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 : Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider * Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
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 for a new top-level scope.

Applies to

ViewDataDictionary(IModelMetadataProvider, Type)

Source:
ViewDataDictionary.cs
Source:
ViewDataDictionary.cs

Initializes a new instance of the ViewDataDictionary class.

protected:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ModelBinding::IModelMetadataProvider ^ metadataProvider, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (metadataProvider As IModelMetadataProvider, declaredModelType As Type)

Parameters

metadataProvider
IModelMetadataProvider

IModelMetadataProvider instance used to create ModelExplorer instances.

declaredModelType
Type

Type of Model values expected. Used to set ModelMetadata.

Remarks

For use when creating a derived ViewDataDictionary for a new top-level scope.

Applies to

ViewDataDictionary(ViewDataDictionary, Type)

Source:
ViewDataDictionary.cs
Source:
ViewDataDictionary.cs

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

protected:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (source As ViewDataDictionary, declaredModelType As Type)

Parameters

source
ViewDataDictionary

ViewDataDictionary instance to copy initial values from.

declaredModelType
Type

Type of Model values expected. Used to set ModelMetadata.

Remarks

For use when copying a ViewDataDictionary instance and new instance's declared ModelType 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 declaredModelType. Pass model: null to ViewDataDictionary(ViewDataDictionary, Object, Type) to ignore source.Model.

Applies to

ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary, Type)

Source:
ViewDataDictionary.cs
Source:
ViewDataDictionary.cs

Initializes a new instance of the ViewDataDictionary class.

protected:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ModelBinding::IModelMetadataProvider ^ metadataProvider, Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateDictionary ^ modelState, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider * Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (metadataProvider As IModelMetadataProvider, modelState As ModelStateDictionary, declaredModelType As Type)

Parameters

metadataProvider
IModelMetadataProvider

IModelMetadataProvider instance used to create ModelExplorer instances.

modelState
ModelStateDictionary

ModelStateDictionary instance for this scope.

declaredModelType
Type

Type of Model values expected. Used to set ModelMetadata.

Remarks

For use when creating a derived ViewDataDictionary for a new top-level scope.

Applies to

ViewDataDictionary(ViewDataDictionary, Object, Type)

Source:
ViewDataDictionary.cs
Source:
ViewDataDictionary.cs

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

protected:
 ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source, System::Object ^ model, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, object model, Type declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, object? model, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary * obj * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (source As ViewDataDictionary, model As Object, declaredModelType As Type)

Parameters

source
ViewDataDictionary

ViewDataDictionary instance to copy initial values from.

model
Object

Value for the Model property.

declaredModelType
Type

Type of Model values expected. Used to set ModelMetadata.

Remarks

For use when copying a ViewDataDictionary instance and new instance's declared ModelType and Model are known.

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

Applies to