我有几个空路由值我想查询字符串:RouteValueDictionary忽略空值
var routeValues = new RouteValueDictionary();
routeValues.Add("one", "");
routeValues.Add("two", null);
routeValues.Add("three", string.Empty);
如果我把它传递给UrlHelper.RouteUrl()
它忽略所有的值和生成的查询字符串是空的。但是,像/?one=&two=&three=
这样的网址完全有效。我怎样才能做到这一点?
'String.Empty'是否会产生相同的结果? –
它的确如此。更新了帖子。 – UserControl
我在这里看不到问题。 –