可能重复:
什么是“??” 运营商?
??
这里的符号是什么意思?
我说得对吗:使用id
,但如果id
为空,则使用字符串“ALFKI”?
public ActionResult SelectionClientSide(string id)
{
ViewData["Customers"] = GetCustomers();
ViewData["Orders"] = GetOrdersForCustomer(id ?? "ALFKI");
ViewData["id"] = "ALFKI";
return View();
}
[GridAction]
public ActionResult _SelectionClientSide_Orders(string customerID)
{
customerID = customerID ?? "ALFKI";
return View(new GridModel<Order>
{
Data = GetOrdersForCustomer(customerID)
});
}