Why does Razor _layout.cshtml have a leading underscore in file name?

前端 未结 5 780
傲寒
傲寒 2020-12-07 16:21

In the default ASP.NET MVC 3 project, layout & partial cshtml files start with an underscore

  • _viewstart
  • _Layout
5条回答
  •  长情又很酷
    2020-12-07 16:44

    As far as I know this is simply a convention used to identify the intent of the file; I don't believe it will actually change the behavior of the file. In most development contexts, prepending an underscore identifies something to be meant for "private" use, whether by a class, or in this case, another template.

提交回复
热议问题