If you define category in UI setting Name and DisplayName, they actually in API are mixed up a bit - Name is Name and DisplayName is Description. Maybe you are misusing them on API side?
There doesn't seem to be any way of getting at that information based on the EPiServer API documentation.
Ah, okay I think I found the magical incantation.
var categories = currentPage.Category; this.CategoryString = string.Join(", ", categories.ToList<Int32>() .Select(i => Category.Find(i).LocalizedDescription));
I wonder why on Earth there's no currentPage.Category.CategoryDescription(2) method.
I'm trying to get the "human-readable" values for Category for a given page. If I use the CategoryName(Int32) method to retrieve a category with spaces, it's being returned with no spaces.
So for example, the Category in the page is defined as "About Us". Its id is '2'.
When I get currentPage.Category.CategoryName(2) the return value is "AboutUs". In contrast, when I view the category in the EPiServer admin interface for the page, it's showing as "About Us".
What's the expected behavior?