ViewFilter.GetSelection Method

Returns the extent of the currently selected text.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.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)

Syntax

'Declaration
Public Function GetSelection As TextSpan
public TextSpan GetSelection()
public:
TextSpan GetSelection()
member GetSelection : unit -> TextSpan
public function GetSelection() : TextSpan

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

See Also

Reference

ViewFilter Class

Microsoft.VisualStudio.Package Namespace