Created
August 22, 2012 15:52
-
-
Save jeremyiverson/3426952 to your computer and use it in GitHub Desktop.
Colectica SDK: Get all categories in a DDI CodeScheme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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