Simple, I want to parse the objects[] parameters to it's value. It returns "{ id = 3 }" if I pass in this value. I want to do string id = 3... How is this possible?
Reason .NET MVC does it this way: Url.Action(ActionName, ControllerName, new { id = 3})
I want to get the value of an Annonymous Type.
GetUrlStringStringObjectArray = (string actionName, string controllerName, **object[] parameters**) =>
{
Assert.AreEqual<string>(EventsController.Actions.Register.ToString(), actionName, "Url.Action called with an incorrect action.");
Assert.AreEqual<string>(EventsController.ControllerName, controllerName, "Url.Action called with an incorrect controller.");
string id = parameters[0].ToString();
// returns "{ id = 3}"
if (!String.IsNullOrWhiteSpace(id))
return String.Format("/{0}/{1}/{2}", controllerName, actionName, id);
else
return String.Format("/{0}/{1}", controllerName, actionName);
}