开发者

Default format of comments for ASP.NET MVC controllers

Can someone explain the format for ASP.NET MVC controllers? They look like this:

public class ProductsController : Controller
{
    //
    // GET: /Products/Edit/34

    public ActionResult Edit(int id)
    {
        // ...
    }
}

Why don't they follow the standard C#-notation with three slashes and XML markup? And why the empty line between the comment and the method?

I my oppinion it should have looked somewhat like this:

public class ProductsController : Controller
{
    /// <remarks>
    /// GET: /Pro开发者_开发知识库ducts/Edit/34
    /// </remarks>
    public ActionResult Edit(int id)
    {
        // ...
    }
}


These are written for person who is writing the code, and not for people who call the controller method (probably nobody will call it directly anyway).

Also, documentation comments imply objectivity and /Products/Edit/34 is not a formal description -- it depends on the route.


I'm only guessing, but the format you specified is not for comments, but for inline documentation. You do have the ability to modify the T4 templates to get the coding style you prefer.


I suppose the author of this comment didn't want it to be included in the documentation of the assembly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜