Share via


Source.GetCommentFormat Method

Gets information on what defines a comment in the language.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
Public Overridable Function GetCommentFormat As CommentInfo
public virtual CommentInfo GetCommentFormat()
public:
virtual CommentInfo GetCommentFormat()
abstract GetCommentFormat : unit -> CommentInfo 
override GetCommentFormat : unit -> CommentInfo 
public function GetCommentFormat() : CommentInfo

Return Value

Type: Microsoft.VisualStudio.Package.CommentInfo
A CommentInfo structure containing the strings that define a comment.

Remarks

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.

.NET Framework Security

See Also

Reference

Source Class

Microsoft.VisualStudio.Package Namespace