Search code examples
c#visual-studiovisual-studio-2012class-extensions

How to navigate to extension methods such as MapHttpRoute of HttpRouteCollectionExtension


In Visual Studio 2012 I'd like to navigate to the MapHttpRoute method from the HttpRouteCollection class.

So for example if I go to the definition of Routes of Routes.MapHttpRoute(), I see Routes is an instance of HttpRouteCollection class. However if I check the definition of HttpRouteCollection I can't find the MapHttpRoute method. Are extension methods hidden?


Solution

  • No, they aren't hidden. They are extension methods that reside in the HttpRouteCollectionExtensions static class, and since you're using an instance of HttpRouteCollection, you're seeing them as an available API.

    enter image description here

    Another way you can tell, should this scenario come up in the future, is to look at the documentation for the method in question.