Class ViewDataDictionary<TModel>
Represents a container that is used to pass strongly typed data between a controller and a view.
public class ViewDataDictionary<TModel> : ViewDataDictionary, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
Type Parameters
TModel
The type of the model.
- Inheritance
-
ViewDataDictionary<TModel>
- Implements
- Inherited Members
Constructors
ViewDataDictionary()
Initializes a new instance of the ViewDataDictionary<TModel> class.
public ViewDataDictionary()
ViewDataDictionary(ViewDataDictionary)
Initializes a new instance of the ViewDataDictionary<TModel> class by using the specified view data dictionary.
public ViewDataDictionary(ViewDataDictionary viewDataDictionary)
Parameters
viewDataDictionary
ViewDataDictionaryAn existing view data dictionary to copy into this instance.
ViewDataDictionary(TModel)
Initializes a new instance of the ViewDataDictionary<TModel> class by using the specified model.
public ViewDataDictionary(TModel model)
Parameters
model
TModelThe data model to use for the view.
Properties
Model
Gets or sets the model.
public TModel Model { get; set; }
Property Value
- TModel
A reference to the data model.
ModelMetadata
Gets or sets information about the model.
public override ModelMetadata ModelMetadata { get; set; }
Property Value
- ModelMetadata
Information about the model.
Methods
SetModel(object)
Sets the data model to use for the view.
protected override void SetModel(object value)
Parameters
value
objectThe data model to use for the view.
Exceptions
- InvalidOperationException
An error occurred while the model was being set.