Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC Files names underscore

There is a naming convention to use underscore prefix for views which are not accessed directly (partial view, layouts, etc.) in ASP.NET MVC razor. I am not sure whether I should to use this prefix for view which is accessed only from child action.

like image 835
SiberianGuy Avatar asked Jul 26 '11 12:07

SiberianGuy


1 Answers

No, you should not. As you said, prefixes are used by convention for views not accessed directly. But if child action has view, it means it IS accessed, so prefixing that view name with underscore would mean breaking another convention (more robust and conventional one :)) - naming views according to action names. So don't prefix them, or you will have to explicitly specify view name in child action.

like image 87
archil Avatar answered Oct 03 '22 06:10

archil