This example is based on code in the TagLifecycle.cs sample file. This file is located in the following vCloud Suite SDK for .NET directory: client/samples/src/Samples/vmware/vcloud/suite/samples/cis/tagging/

This example is based on the information that is provided in Creating a Tag Category.

The category Create() function returns an identifier that you use when you create a tag for that category. The empty set for the associable types indicates that any object type can be associated with a tag in this category.

using vmware.cis.tagging;
using System.Collections.Generic;
 
var categoryStub = myStubFactory.CreateStub<Category>(myStubConfiguration);
 
// Set up a tag category create spec.
var createSpec = new CategoryTypes.CreateSpec();
createSpec.SetName(“favorites”);
createSpec.SetDescription(“My favorite virtual machines.”);
createSpec.SetCardinality(CategoryModel.Cardinality.MULTIPLE);
HashSet<String> associableTypes = new HashSet<String>();
createSpec.SetAssociableTypes(associableTypes);
 
// Create the tag category.
String newCategoryId = categoryStub.Create(createSpec);