Peter, when using the first option I get this message displayed:
CMS.DataEngine.CollectionPropertyWrapper`1[CMS.DataEngine.BaseInfo]
When using second option I get this error:
error CS1061: 'IInfoObjectCollection' does not contain a definition for 'Transform' and no extension method 'Transform' accepting a first argument of type 'IInfoObjectCollection' could be found (are you missing a using directive or an assembly reference?)[TempITemplate.Template]
BTW, I'm using ASCX transformation type.
First option:
<%# CurrentDocument.Categories.DisplayNames %>
Second Option:
<%# CurrentDocument.Categories.Transform("ID: {#CategoryId#} Name: {#DisplayName#}<br>") %>