Opc.Ua.SimpleAttributeOperand.Format C# (CSharp) Method

Format() public static method

Formats a browse path.
public static Format ( IList browsePath ) : string
browsePath IList
return string
        public static string Format(IList<QualifiedName> browsePath)
        {
            if (browsePath == null || browsePath.Count == 0)
            {
                return String.Empty;
            }

            StringBuilder buffer = new StringBuilder();

            for (int ii = 0; ii < browsePath.Count; ii++)
            {
                QualifiedName browseName = browsePath[ii];

                if (QualifiedName.IsNull(browseName))
                {
                    throw ServiceResultException.Create(StatusCodes.BadBrowseNameInvalid, "BrowseName cannot be null");
                }

                buffer.Append('/');
                
                if (browseName.NamespaceIndex != 0)
                {
                    buffer.AppendFormat("{0}:", browseName.NamespaceIndex);
                }

                for (int jj = 0; jj < browseName.Name.Length; jj++)
                {
                    char ch = browseName.Name[jj];

                    if (ch == '&' || ch == '/')
                    {
                        buffer.Append('&');
                    }

                    buffer.Append(ch);
                }
            }

            return buffer.ToString();
        }