I just happened across a handy class within the SharePoint object model which allows finding where a content type is currently in use within a site much quicker than using the custom code I had previously been using. This would be handy when unable to delete a content type because it is in use, or if we simply want to know if a content type is in use somewhere within our SharePoint site.
Used to track available content types used throughout a site collection.
// get content type from supplied id
SPContentType ctype = SPContext.Current.Web.ContentTypes[new SPContentTypeId(ctypeId)];
// get list containing all references
IList<SPContentTypeUsage> usageList = SPContentTypeUsage.GetUsages(ctype);
if (usageList.Count > 0)
for (int count = 0; count < usageList.Count; count++)
// do something
I found the above information while looking at the link below detailing the Microsoft.SharePoint Namespace: