I'm trying to attach a custom content type to Document Library so that it's available to users whenever they upload a new document, they'll have the necessary columns visible. I'm struggling to staple this onto SharePoint 2010 and cannot really find a solution to this online.
You can attach a contenttype to a list in a feature:
And in code:
This isn't production code, please add some checks and exception handling.