ViewFilter.GetSelection Method
Returns the extent of the currently selected text.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
Syntax
'宣告
Public Function GetSelection As TextSpan
public TextSpan GetSelection()
Return Value
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
Returns a TextSpan object specifying the selected span of text.
Remarks
This method calls the GetSelectionSpan method on the IVsTextView object passed to the ViewFilter class constructor. The resulting TextSpan object contains the span of the selected text or the location of the caret if no text is selected.
.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.