Source.CommentSpan Method
Comments out the specified span of source.
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
'Dichiarazione
Public Overridable Function CommentSpan ( _
span As TextSpan _
) As TextSpan
'Utilizzo
Dim instance As Source
Dim span As TextSpan
Dim returnValue As TextSpan
returnValue = instance.CommentSpan(span)
public virtual TextSpan CommentSpan(
TextSpan span
)
public:
virtual TextSpan CommentSpan(
TextSpan span
)
abstract CommentSpan :
span:TextSpan -> TextSpan
override CommentSpan :
span:TextSpan -> TextSpan
public function CommentSpan(
span : TextSpan
) : TextSpan
Parameters
- span
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
A TextSpan object describing the span of source to comment out.
Return Value
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
A new TextSpan object encompassing the entire commented out span, including any comment start and end strings.
Remarks
This method determines how best to comment out the span by deciding between line and block comments, and then calls the CommentBlock or CommentLines methods on the span. Call the GetCommentFormat method to obtain the strings that define a comment.
The base method calls the GetCommentFormat method, and then calls the CommentLines method if the line comment string is specified; otherwise, calls the CommentBlock method if the block comment strings are specified. Note that this approach always uses line comments if both line comment and block comment strings are specified -- even when commenting out a block of text.
This method is typically called in response to the user selecting the command Comment Selection from the Advanced menu on the Edit menu.
See Commenting Code (Managed Package Framework) for more information on this method is used.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.Package Namespace