public static string ReindentStartOfXmlDocumentationComment(
            this string triviaText,
            bool forceIndentation,
            int indentation,
            int indentationDelta,
            bool useTab,
            int tabSize,
            string newLine)
        {
            var builder = StringBuilderPool.Allocate();

            // split xml doc comments into lines
            var lines = triviaText.Split('\n');

            Contract.ThrowIfFalse(lines.Length > 0);

            // add first line and append new line iff it is not a single line xml doc comment
            builder.Append(lines[0].Trim(s_trimChars));
            if (0 < lines.Length - 1)
            {
                builder.Append(newLine);
            }

            // add rest of xml doc comments
            for (int i = 1; i < lines.Length; i++)
            {
                var line = lines[i].TrimEnd(s_trimChars);
                var nonWhitespaceCharIndex = GetFirstNonWhitespaceIndexInString(line);
                if (nonWhitespaceCharIndex >= 0)
                {
                    var newIndentation = GetNewIndentationForComments(line, nonWhitespaceCharIndex, forceIndentation, indentation, indentationDelta, tabSize);
                    builder.AppendIndentationString(newIndentation, useTab, tabSize);
                    builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex);
                }

                if (i < lines.Length - 1)
                {
                    builder.Append(newLine);
                }
            }

            return(StringBuilderPool.ReturnAndFree(builder));
        }