using (SPSite site = new SPSite("http://devsp2010:1001"))
{
//Instantiates a new TaxonomySession for the current site.
TaxonomySession session = new TaxonomySession(site);
//Instantiates the connection "Managed Metadata Service Connection" for session
TermStore termStore = session.TermStores["Managed Metadata Service Connection"];
// Creates and commits a Group object, a TermSet object and several Term objects
Group group1 = termStore.CreateGroup("Rez Term Sets");
TermSet termSet1 = group1.CreateTermSet("Corporate Departments");
Term term1 = termSet1.CreateTerm("IT", 1033);
Term term2 = termSet1.CreateTerm("Marketing", 1033);
termStore.CommitAll();
// Sets a description and some alternate labels term1 and commits
term1.SetDescription("Name of information tech dept", 1033);
term1.CreateLabel("Information Technology", 1033, false);
term1.CreateLabel("ITech", 1033, false);
termStore.CommitAll();
// Deletes an unnecessary term
term2.Delete();
termStore.CommitAll();
}