Пример #1
0
        /// <summary>
        /// Returns a string representation of the relative identifier.
        /// </summary>
        /// <param name="table">The string table used when creating the PartialSymbol.</param>
        public string ToString(StringTable table)
        {
            Contract.Requires(IsValid);
            Contract.RequiresNotNull(table);

            int length = 0;

            foreach (StringId component in m_components)
            {
                length += table.GetLength(component) + 1;
            }

            if (length > 0)
            {
                length--;
            }

            using (var wrap = Pools.GetStringBuilder())
            {
                StringBuilder sb = wrap.Instance;

                foreach (StringId component in m_components)
                {
                    if (sb.Length > 0)
                    {
                        sb.Append(SymbolCharacters.DottedIdentifierSeparatorChar);
                    }

                    table.CopyString(component, sb);
                }

                return(sb.ToString());
            }
        }