In this post we will answer one of the doubts that some people have when developing web applications with ASP.NET MVC: What is the difference between model and Model?
When we develop an ASP.NET MVC application, if we go to a view that uses a model, we can see that at the top of the view it says something like:
This code indicates that the type of data of the model to be used in the view is Person. Which means that in our solution we have a class called Person, which represents the type of data of the model of our view. Of course, we are not limited to using classes. We can use primitive types. For example, we could use an integer:
Now, one thing is the type of data, and another thing is the data per se. The variable where the model of our view is stored is called: Model.
So, in the case that the data type of the model is Person, if the Person class has a property called Age, then I can write:
To write the value of the age of the model that was sent to the view by the controller.
model => data type
Model => the data itself