In the following:
public ActionResult Index()
{
// Create a list of genres
var genres = new List<string> {"Rock", "Jazz", "Country", "Pop", "Disco" };
// Create our view model
var viewModel = new StoreIndexViewModel {
NumberOfGenres = genres.Count(),
Genres = genres
};
return View(viewModel);
}
Why was var genres and var viewModel instead of explicitly declaring their types?
Thanks