我使用此ActionLink方法来生成方法。
LinkExtensions.ActionLink Method (HtmlHelper, String, String, Object)
所以第四个参数是一个包含匿名属性的对象,用于路由。
可以将新的匿名属性自动附加/添加到现有的 routeValues 是 Object 吗?
如果是,如何?
假设我有一个方法:
public void Test( ref object currentRouteValues, string newValue)
{
if(!string.IsNullOrEmpty(newValue)){
// add a custom property here to currentRouteValues
// something like: (is wrong but I don't know how to proceed)
currentRouteValues = new { currentRouteValues, myCustoProperty = newValue };
}
}
如何为上述方法自动执行此操作?
谢谢