public void GetWorkItemCategory() { CategoryCollection categories = TeamProject.Categories; // Can get a category via index, reference name, or Enumerable methods on Categories collection. var categoriesCount = categories.Count; var categoryReferenceName = DefaultCategoryReferenceName; var lastCategory = categories[categoriesCount - 1]; Console.WriteLine($"Category at index: '{categoriesCount - 1}' in Project: '{TeamProject.Name}' has name: '{lastCategory.Name}'"); var namedCategory = categories[categoryReferenceName]; Console.WriteLine($"Category with reference name: '{categoryReferenceName}' in Project: '{TeamProject.Name}' has name: '{namedCategory.Name}'"); var firstCategory = categories.First(); Console.WriteLine($"Category accessed via First() in Project: '{TeamProject.Name}' has name: '{firstCategory.Name}'"); Console.WriteLine(); }