Delen via


ExpansionFunction.GetSelection Method

Gets the span of the selected text in the current view.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  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 (in Microsoft.VisualStudio.Package.LanguageService.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
A TextSpan object containing the span of the selected text.

Remarks

This helper method calls the GetSelection method on the IVsTextView object that is contained in the ExpansionProvider object. If the ExpansionProvider object is not available, the returned TextSpan object has all of its fields set to 0.

.NET Framework Security

See Also

Reference

ExpansionFunction Class

Microsoft.VisualStudio.Package Namespace