Opc.Ua.Server.NodeSource.GetDisplayPath C# (CSharp) Method

GetDisplayPath() public method

Builds a path of display names starting with the top most parent.
public GetDisplayPath ( int count ) : LocalizedText
count int
return LocalizedText
        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();
        }