共用方式為


ITextSelection.VirtualSelectedSpans Property

The currently-selected spans, as VirtualSnapshotSpan objects.

Namespace:  Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

Syntax

'宣告
ReadOnly Property VirtualSelectedSpans As ReadOnlyCollection(Of VirtualSnapshotSpan)
ReadOnlyCollection<VirtualSnapshotSpan> VirtualSelectedSpans { get; }
property ReadOnlyCollection<VirtualSnapshotSpan>^ VirtualSelectedSpans {
    ReadOnlyCollection<VirtualSnapshotSpan>^ get ();
}
abstract VirtualSelectedSpans : ReadOnlyCollection<VirtualSnapshotSpan>
function get VirtualSelectedSpans () : ReadOnlyCollection<VirtualSnapshotSpan>

Property Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<VirtualSnapshotSpan>
A collection of currently-selected spans.

Remarks

This span collection is never empty, but the spans in this collection may be 0-length. This value can be very expensive to compute for the first time after the selection has changed, or after the view has done a layout. Use GetSelectionOnTextViewLine unless you need the entire selection.

.NET Framework Security

See Also

Reference

ITextSelection Interface

Microsoft.VisualStudio.Text.Editor Namespace