【发布时间】:2014-06-17 13:51:17
【问题描述】:
我是 C# .NET 的新手,我有以下疑问。
在我正在处理的页面上,我找到了以下链接:
<a class="ui-btn-inline ui-btn ui-icon-delete ui-btn-icon-notext ui-corner-all" href="@Url.Action("Delete", "Groups", new { id = item.gruppoId })">Delete</a>
此链接调用 GroupsController 类的 Delete() 方法。
好的,就是这个方法:
public ActionResult Delete(int id = 0)
{
.......................
.......................
.......................
DO SOME STUFF
.......................
.......................
.......................
return View(model);
}
我的疑惑与这个方法的签名有关:为什么参数int id = 0?
= 0 是什么意思?一开始,我认为这是一个简单的初始化,它将 it 值更改为 0,但使用调试器我发现它不会更改 id 值。那么它到底是做什么的呢?
【问题讨论】:
标签: c# asp.net .net asp.net-mvc