Following this page : http://blogs.msdn.com/b/webdev/archive/2013/10/17/attribute-routing-in-asp-net-mvc-5.aspx
These routes are supported:
[Route("users/{id:int}")]
public ActionResult GetUserById(int id) { . . . }
[Route("users/{id?}")]
public ActionResult GetUserById(int? id) { . . . }
But it seems that optional Nullabble< int > is not supported:
[Route("users/{id:int?}")]
public ActionResult GetUserById(int? id) { . . . }
Is there a way to use this ?
int?and the supported one is, well, supported. - D. Ben Knobleid:int?- D. Ben Knobleint?where the type could be an integer ornull. I think this is a classic xy problem. Can you please explain the problem and not your desired solution? - Dalorzoint?can be int or null; i dont see any difference in the declarations of the two methods other than the attributes. My question is, whats wrong with the one that works? - D. Ben Knoble