Source.GetCommentFormat Method


Override this method if you want to provide different comment dilimiters. You can turn off commenting by setting Preferences.EnableCommenting to false.

 virtual Microsoft::VisualStudio::Package::CommentInfo GetCommentFormat();
 virtual Microsoft::VisualStudio::Package::CommentInfo GetCommentFormat();
public virtual Microsoft.VisualStudio.Package.CommentInfo GetCommentFormat ();
abstract member GetCommentFormat : unit -> Microsoft.VisualStudio.Package.CommentInfo
override this.GetCommentFormat : unit -> Microsoft.VisualStudio.Package.CommentInfo
Public Overridable Function GetCommentFormat () As CommentInfo



A CommentInfo structure containing the strings that define a comment.


To support adding comments to and removing comments from source code, the Source class needs to know what defines a line comment (runs from the line comment characters to the end of the line) and block comment (runs from the start block comment characters to the end block comment characters, often spanning multiple lines). This method provides that information. If your language does not use the C#/C++ format for comments, then you must derive a class from the Source class and override this method to provide the appropriate comment delimiters.

The base method creates a new CommentInfo and fills it in with C#/C++ line and block comment delimiters, specifically, "//", "/*", and "*/". The base method also indicates that line comments can be used.

Applies to