Many organizations use the content-type hub to manage content-types in their SharePoint 2010 environment. As a developer in these types of organizations, you may one day find yourself in need of getting the URL of the content type hub programmatically. Here is a quick snippet that demonstrates how to do it fairly painlessly:
public static Uri GetContentTypeHubUri(SPSite site)      
{       
    TaxonomySession session = new TaxonomySession(site);       
    return Session.DefaultSiteCollectionTermStore     
        .ContentTypePublishingHub;     
}
        
Load comments