XmlCommentSerializationSrc/XmlCommentSerialization/XmlCommentElement.cs
/// <summary>
/// Writes the actual comment to the XmlWriter wrapping onto multiple lines
/// of text if required.
/// </summary>
/// <param name="writer">XmlWriter to output to.</param>
/// <param name="comment">Zero or more length string to output</param>
Writes the actual comment to the XmlWriter wrapping onto multiple lines
of text if required.
Writes the actual comment to the XmlWriter wrapping onto multiple lines of text if required .
private void WriteXmlComment(XmlWriter writer, string comment)
        {
            while (comment != null && comment.Length > 0)
            {
                string substring;
                if (_MaxLength > 0)
                {
                    substring = comment.Substring(0, Math.Min(comment.Length, _MaxLength));
                    if (substring.Length == _MaxLength)
                    {
                        int lastSpaceChar = substring.LastIndexOf(' ');
                        if (lastSpaceChar != -1)
                            substring = substring.Substring(0, lastSpaceChar);
                    }
                }
                else
                    substring = comment;
                comment = comment.Substring(substring.Length).TrimStart();
                if (comment.Length > 0)
                {
                    comment = String.Format("{0} {1}", Resource.CommentWrap, comment);
                    substring = String.Format("{0} {1}", substring, Resource.CommentWrap);
                }
                writer.WriteComment(String.Format(Resource.CommentPadding, substring));
            }
        }
private void WriteXmlComment ( XmlWriter writer , string comment ) { while ( comment != null && comment . Length > 0 ) { string substring ; if ( _MaxLength > 0 ) { substring = comment . Substring ( 0 , Math . Min ( comment . Length , _MaxLength ) ) ; if ( substring . Length == _MaxLength ) { int lastSpaceChar = substring . LastIndexOf ( ' ' ) ; if ( lastSpaceChar != - 1 ) substring = substring . Substring ( 0 , lastSpaceChar ) ; } } else substring = comment ; comment = comment . Substring ( substring . Length ) . TrimStart ( ) ; if ( comment . Length > 0 ) { comment = String . Format ( " " , Resource . CommentWrap , comment ) ; substring = String . Format ( " " , substring , Resource . CommentWrap ) ; } writer . WriteComment ( String . Format ( Resource . CommentPadding , substring ) ) ; } }
Writes the actual comment to the XmlWriter wrapping onto multiple lines
of text if required.
Writes the actual comment to the XmlWriter wrapping onto multiple lines of text if required .
// Wrap the comment on multiple lines as required. // If wrapping, back-up and wrap on last space (if possible) // Remove text about to be output from the comment // More lines of comment required. Postfix and Prefix with CommentWrap // Output comment to XmlWriter
writer
XmlWriter
XmlWriter to output to.
XmlWriter to output to .
comment
string
Zero or more length string to output
Zero or more length string to output