One idea for ASP.NET MVC… strong typed View names
I really hate magic numbers, strings, etc… In all my projects I really try to avoid them as much as possible.
Wouldn’t it be nice if MS (or we as a community if they don’t… I can think of several ways to do it) would generate a strongly typed class called Views which contains the name of each View in the application, so like:
- View.Home
- View.About
- View.Contact
- VIew.Products
and instead of referencing by magic string:
something like this (of course implemented all over, not only in ActionLink):
(Resharper has put it in red… disregard that coloring issue)
Arguably a small detail… but as I said, not too hard to implement and… I REALLY hate magic strings
What do you think?

Leave a Reply