From b4735df891c391c24d13e90e198fc1e962303df5 Mon Sep 17 00:00:00 2001
From: Kimon Topouzidis <ktopouzi@it.teithe.gr>
Date: Tue, 1 Aug 2017 14:07:04 +0300
Subject: [PATCH] Included the comments plain text to the remarks block. (#907)

---
 .../Generators/CSharp/CSharpCommentPrinter.cs | 22 +++++++++++++------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/Generator/Generators/CSharp/CSharpCommentPrinter.cs b/src/Generator/Generators/CSharp/CSharpCommentPrinter.cs
index 76854c99..38b713d9 100644
--- a/src/Generator/Generators/CSharp/CSharpCommentPrinter.cs
+++ b/src/Generator/Generators/CSharp/CSharpCommentPrinter.cs
@@ -50,6 +50,8 @@ namespace CppSharp.Generators.CSharp
                             if (inlineContentComment.HasTrailingNewline)
                                 sections.Last().NewLine();
                         }
+                    if (!string.IsNullOrEmpty(sections.Last().CurrentLine.ToString()))
+                        sections.Add(new Section(CommentElement.Remarks));
                     break;
                 case DocumentationCommentKind.TParamCommandComment:
                     break;
@@ -60,13 +62,18 @@ namespace CppSharp.Generators.CSharp
                 case DocumentationCommentKind.ParagraphComment:
                     var summaryParagraph = sections.Count == 1;
                     var paragraphComment = (ParagraphComment) comment;
+                    var lastParagraphSection = sections.Last();
                     foreach (var inlineContentComment in paragraphComment.Content)
                     {
                         inlineContentComment.GetCommentSections(sections);
                         if (inlineContentComment.HasTrailingNewline)
-                            sections.Last().NewLine();
+                            lastParagraphSection.NewLine();
                     }
-                    if (summaryParagraph)
+
+                    if (!string.IsNullOrEmpty(lastParagraphSection.CurrentLine.ToString()))
+                        lastParagraphSection.NewLine();
+
+                    if (sections[0].GetLines().Count > 0 && summaryParagraph)
                     {
                         sections[0].GetLines().AddRange(sections.Skip(1).SelectMany(s => s.GetLines()));
                         sections.RemoveRange(1, sections.Count - 1);
@@ -80,20 +87,21 @@ namespace CppSharp.Generators.CSharp
                 case DocumentationCommentKind.HTMLEndTagComment:
                     break;
                 case DocumentationCommentKind.TextComment:
-                    var section = sections.Last();
-                    section.CurrentLine.Append(GetText(comment,
-                        section.Type == CommentElement.Returns || section.Type == CommentElement.Param).Trim());
+                    var lastTextsection = sections.Last();
+                    lastTextsection.CurrentLine.Append(GetText(comment,
+                        lastTextsection.Type == CommentElement.Returns ||
+                        lastTextsection.Type == CommentElement.Param).Trim());
                     break;
                 case DocumentationCommentKind.InlineContentComment:
                     break;
                 case DocumentationCommentKind.InlineCommandComment:
-                    var lastSection = sections.Last();
+                    var lastInlineSection = sections.Last();
                     var inlineCommand = (InlineCommandComment) comment;
 
                     if (inlineCommand.CommandKind == CommentCommandKind.B)
                     {
                         var argText = $" <c>{inlineCommand.Arguments[0].Text}</c> ";
-                        lastSection.CurrentLine.Append(argText);
+                        lastInlineSection.CurrentLine.Append(argText);
                     }
                     break;
                 case DocumentationCommentKind.VerbatimBlockLineComment: