The RouteCollection class provides methods that enable you to manage a collection of objects that derive from the RouteBase class.
Typically, you will use the static Routes property of the RouteTable class to retrieve a RouteCollection object. The Routes property stores all the routes for an ASP.NET application. ASP.NET routing iterates through the routes in the Routes property to find the route that matches a URL.
To construct a URL, you call the GetVirtualPath method and pass in a collection of values. The GetVirtualPath method finds the first route with parameters that match the values that you passed in, and returns a VirtualPathData object that contains information about the matching route. You retrieve the URL through the VirtualPath property of the VirtualPathData object.
You can add a route either with a name or without a name. Including a name enables you to distinguish between similar routes when URLs are constructed. If you do not specify a name, ASP.NET routing uses the first matching route in the collection to construct a URL.
When you add an unnamed route to the RouteCollection object, you cannot add a route that already is in the collection. When you add a named route, you cannot use a name that already identifies a route in the collection.
You use the GetReadLock method and the GetWriteLock method to make sure that you interact with the collection without conflicts from other processes.