Compartir a través de


SnapshotSpan Constructors

Definition

Overloads

SnapshotSpan(ITextSnapshot, Span)

Initializes a new instance of a SnapshotSpan with the specified snapshot and span.

SnapshotSpan(SnapshotPoint, SnapshotPoint)

Initializes a new instance of a SnapshotSpan from two SnapshotPoint objects.

SnapshotSpan(SnapshotPoint, Int32)

Initializes a new instance of a SnapshotSpan from an existing SnapshotPoint and a specified length.

SnapshotSpan(ITextSnapshot, Int32, Int32)

Initializes a new instance of a SnapshotSpan with the specified snapshot, start point, and length.

SnapshotSpan(ITextSnapshot, Span)

Initializes a new instance of a SnapshotSpan with the specified snapshot and span.

public:
 SnapshotSpan(Microsoft::VisualStudio::Text::ITextSnapshot ^ snapshot, Microsoft::VisualStudio::Text::Span span);
public:
 SnapshotSpan(Microsoft::VisualStudio::Text::ITextSnapshot ^ snapshot, Microsoft::VisualStudio::Text::Span span);
 SnapshotSpan(Microsoft::VisualStudio::Text::ITextSnapshot const & snapshot, Microsoft::VisualStudio::Text::Span span);
public SnapshotSpan (Microsoft.VisualStudio.Text.ITextSnapshot snapshot, Microsoft.VisualStudio.Text.Span span);
new Microsoft.VisualStudio.Text.SnapshotSpan : Microsoft.VisualStudio.Text.ITextSnapshot * Microsoft.VisualStudio.Text.Span -> Microsoft.VisualStudio.Text.SnapshotSpan
Public Sub New (snapshot As ITextSnapshot, span As Span)

Parameters

snapshot
ITextSnapshot

The ITextSnapshot on which to base the snapshot span.

span
Span

The span of the snapshot span.

Exceptions

snapshot is null.

span.End is greater than snapshot.Length.

Applies to

SnapshotSpan(SnapshotPoint, SnapshotPoint)

Initializes a new instance of a SnapshotSpan from two SnapshotPoint objects.

public:
 SnapshotSpan(Microsoft::VisualStudio::Text::SnapshotPoint start, Microsoft::VisualStudio::Text::SnapshotPoint end);
public SnapshotSpan (Microsoft.VisualStudio.Text.SnapshotPoint start, Microsoft.VisualStudio.Text.SnapshotPoint end);
new Microsoft.VisualStudio.Text.SnapshotSpan : Microsoft.VisualStudio.Text.SnapshotPoint * Microsoft.VisualStudio.Text.SnapshotPoint -> Microsoft.VisualStudio.Text.SnapshotSpan
Public Sub New (start As SnapshotPoint, end As SnapshotPoint)

Parameters

start
SnapshotPoint

The start point.

end
SnapshotPoint

The end point, which must be from the same ITextSnapshot as the start point.

Exceptions

The snapshot points belong to different ITextSnapshot objects.

The end point comes before the start point.

Applies to

SnapshotSpan(SnapshotPoint, Int32)

Initializes a new instance of a SnapshotSpan from an existing SnapshotPoint and a specified length.

public:
 SnapshotSpan(Microsoft::VisualStudio::Text::SnapshotPoint start, int length);
public SnapshotSpan (Microsoft.VisualStudio.Text.SnapshotPoint start, int length);
new Microsoft.VisualStudio.Text.SnapshotSpan : Microsoft.VisualStudio.Text.SnapshotPoint * int -> Microsoft.VisualStudio.Text.SnapshotSpan
Public Sub New (start As SnapshotPoint, length As Integer)

Parameters

start
SnapshotPoint

The starting snapshot point.

length
Int32

The length of the span.

Exceptions

length is negative or start + length is greater than the length of the snapshot.

Applies to

SnapshotSpan(ITextSnapshot, Int32, Int32)

Initializes a new instance of a SnapshotSpan with the specified snapshot, start point, and length.

public:
 SnapshotSpan(Microsoft::VisualStudio::Text::ITextSnapshot ^ snapshot, int start, int length);
public:
 SnapshotSpan(Microsoft::VisualStudio::Text::ITextSnapshot ^ snapshot, int start, int length);
 SnapshotSpan(Microsoft::VisualStudio::Text::ITextSnapshot const & snapshot, int start, int length);
public SnapshotSpan (Microsoft.VisualStudio.Text.ITextSnapshot snapshot, int start, int length);
new Microsoft.VisualStudio.Text.SnapshotSpan : Microsoft.VisualStudio.Text.ITextSnapshot * int * int -> Microsoft.VisualStudio.Text.SnapshotSpan
Public Sub New (snapshot As ITextSnapshot, start As Integer, length As Integer)

Parameters

snapshot
ITextSnapshot

The text snapshot on which to base the snapshot span.

start
Int32

The starting point of the snapshot span.

length
Int32

The length of the snapshot span.

Exceptions

snapshot is null.

start is negative or greater than snapshot.Length, or length is negative or start + length is greater than snapshot.Length.

Applies to