2

When writing an XML comment in C# it looks like the below, but when you minimize it then all you see is the summary title instead of the summary that you actually typed. In VB.Net it works the way i would expect and displays the comment text when minimized. Any way to adjust this behaviour through an extension or otherwise?

Regular

    /// <summary>
    ///     Some Comment
    /// </summary>
    public int MyProperty { get; set; }

Minimized

    |/// <summary> ...|
    public int MyProperty { get; set; }

Ideal Minimized

    | Some Comment |
    public int MyProperty { get; set; }

Update. Here is an example from VB.Net. I can't believe i am saying this, but it would be great if C# would work the same way.

Regular

    ''' <summary>
    ''' Some Comment
    ''' </summary>
    ''' <remarks></remarks>
    Sub Main()

    End Sub

Minimized

    |Some Comment|
    Sub Main()

    End Sub
5
  • This is more of a visual-studio related question. What version are you using? Commented Aug 13, 2014 at 21:55
  • 1
    No, this is the way Visual Studio is designed. It is consistent with the code-folding behavior that occurs everywhere else besides comments. Commented Aug 13, 2014 at 21:58
  • try deleting the comments and starting over.. but if you hover over the minimized you will probably see the code snippet Commented Aug 13, 2014 at 21:58
  • @DJKRAZE: It will still do the same thing. Commented Aug 13, 2014 at 21:58
  • 1
    @RobertHarvey I always wondered about this too; I think the focus of the question is whether there are any extensions or add-ins that can do this. Commented Aug 13, 2014 at 21:59

1 Answer 1

2

Visual Studio always collapses to the first line of text in a block, whatever that is. If you want to see the summary when an XML comment is collapsed, you have to put it on the first line, line this:

/// <summary>Some Comment</summary>
/// <remarks>
/// </remarks>
public int MyProperty { get; set; }

Which collapses to

/// <summary>Some Comment</summary> ...
public int MyProperty { get; set; }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.