I have code (to help with URL routing) that is trying to find an action method in the controller.
My controller looks like this:
public ActionResult Item(int id) { MyViewModel model = new MyViewModel(id); return View(model); } [HttpPost] public ActionResult Item(MyViewModel model) {
The following code tries to find a method that matches the url action:
Today, this code chose System.Reflection.AmbiguousMatchException: Ambiguous match found , which makes sense, given that my two methods have the same name.
I looked at the available methods of the Type object and found public MethodInfo[] GetMethods(); which seems to do what I want, except that there is no overload for finding a method with a specific name.
I could just use this method and look for everything that it returns, but I'm wondering if there is another (simpler) way to get a list of all the methods in the class with a specific name when there are several.
Mansfield
source share