Export (0) Print
Expand All
Expand Minimize

Source.GetCommentFormat Method

Gets information on what defines a comment in the language.

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

public virtual CommentInfo GetCommentFormat()

Return Value

Type: Microsoft.VisualStudio.Package.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.

© 2014 Microsoft