views:

39

answers:

3

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: /Products/Edit/34
    /// </remarks>
    public ActionResult Edit(int id)
    {
        // ...
    }
}
A: 

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

Darin Dimitrov
A: 

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.

Neil T.
+2  A: 

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.

Andrey Shchekin