How does the implementation of MapRoute connect the {id} in the second parameter to id = in the third?
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Is it as simple as reflecting on the passed in object?
Yes.
It creates a
RouteValueDictionaryinstance from thedefaultsparameter, which populates itself from the object’sPropertyDescriptors.You can see this in the source: