Depending on the case, SPObject.Name string based comparison is quite unsafe and might lead to the potential issues. In case of loop the result is performance degradation.

The following properties are checked:

var session = new TaxonomySession(site);
var termStore = session.TermStores["Company"];

var group = termStore.Groups["HR"];
var termSet = group.TermSets["Review"];
var term = termSet.Terms["Year 2012"];

// wrong
if (group.Name != "HR")
    // wrong
    if (term.Name != "Review")
        // Do stuff


  • Use Object.ID instead or other key property
  • Git rid of string comparison in loop


No links are provided.