Asp .Net MVC Viewmodel should be class or struct?
- by Jonas Everest
Hey guys,
I have just been thinking about the concept of view model object we create in asp.net MVC. Our purpose is to instantiate it and pass it from controller to view and view read it and display the data.
Those view model are usually instantiated through constructor. We won't need to initialize the members, we may not need to redefine/override parameterless constructor and we don't need inheritance feature there.
So, why don't we use struct type for our view model instead of class. It will enhance the performance.