/// <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()); } }
/// <summary> /// Returns a string representation of the relative path. /// </summary> /// <param name="table">The string table used when creating the RelativePath.</param> /// <param name="pathFormat">Optional override for path format.</param> public string ToString(StringTable table, PathFormat pathFormat = PathFormat.HostOs) { Contract.Requires(IsValid); Contract.Requires(table != null); Contract.Ensures(Contract.Result <string>() != null); var pathSeparator = PathFormatter.GetPathSeparator(pathFormat); using (var wrap = Pools.GetStringBuilder()) { StringBuilder sb = wrap.Instance; foreach (StringId component in Components) { if (sb.Length > 0) { sb.Append(pathSeparator); } table.CopyString(component, sb); } return(sb.ToString()); } }