public LocalizedText GetDisplayPath(int count)
{
// collect the display names.
Stack<LocalizedText> displayNames = new Stack<LocalizedText>();
NodeSource parent = this;
while (parent != null)
{
displayNames.Push(parent.DisplayName);
parent = parent.Parent;
if (count > 0 && count <= displayNames.Count)
{
break;
}
}
// construct a string with '/' seperators between the names.
StringBuilder displayPath = new StringBuilder();
while (displayNames.Count > 0)
{
if (displayPath.Length > 0)
{
displayPath.Append('/');
}
displayPath.AppendFormat("{0}", displayNames.Pop());
}
return displayPath.ToString();
}