Skip to content

Instantly share code, notes, and snippets.

@jeremyiverson
Created August 22, 2012 15:52
Show Gist options
  • Save jeremyiverson/3426952 to your computer and use it in GitHub Desktop.
Save jeremyiverson/3426952 to your computer and use it in GitHub Desktop.
Colectica SDK: Get all categories in a DDI CodeScheme
public void OutputAllCodesAndCategories(DdiInstance instance)
{
var allCodeLists = from rp in instance.ResourcePackages
from cs in rp.CodeSchemes
select cs;
foreach (CodeScheme codeList in allCodeLists)
{
Console.WriteLine("Code List: " + codeList.DisplayLabel);
// Note the use of GetFlattenedCodes method instead of codeList.CategoryScheme.
// codeList.CategoryScheme is an optional reference to a CategoryScheme
// that may or may not contain all the Categories used in this CodeScheme.
// Also, the CategoryScheme reference may be null.
foreach (Code code in codeList.GetFlattenedCodes())
{
Console.WriteLine(string.Format("{0}: {1}", code.Value, code.Category.DisplayLabel));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment