Share via


TextRange Constructors

Definition

Overloads

TextRange(TextPosition, TextPosition)

Initializes a new instance of a TextRange from two TextPosition objects.

TextRange(TextPosition, Int32)

Initializes a new instance of a TextRange from an existing TextPosition and a specified length.

TextRange(ITextDocumentSnapshot, Int32, Int32)

Initializes a new instance of a TextRange with the specified document, start point, and length.

TextRange(TextPosition, TextPosition)

Initializes a new instance of a TextRange from two TextPosition objects.

public TextRange (Microsoft.VisualStudio.Extensibility.Editor.TextPosition start, Microsoft.VisualStudio.Extensibility.Editor.TextPosition end);
new Microsoft.VisualStudio.Extensibility.Editor.TextRange : Microsoft.VisualStudio.Extensibility.Editor.TextPosition * Microsoft.VisualStudio.Extensibility.Editor.TextPosition -> Microsoft.VisualStudio.Extensibility.Editor.TextRange
Public Sub New (start As TextPosition, end As TextPosition)

Parameters

start
TextPosition

The start position.

end
TextPosition

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

Exceptions

The positions belong to different ITextDocumentSnapshot objects.

The end point comes before the start point.

Applies to

TextRange(TextPosition, Int32)

Initializes a new instance of a TextRange from an existing TextPosition and a specified length.

public TextRange (Microsoft.VisualStudio.Extensibility.Editor.TextPosition start, int length);
new Microsoft.VisualStudio.Extensibility.Editor.TextRange : Microsoft.VisualStudio.Extensibility.Editor.TextPosition * int -> Microsoft.VisualStudio.Extensibility.Editor.TextRange
Public Sub New (start As TextPosition, length As Integer)

Parameters

start
TextPosition

The starting position.

length
Int32

The length of the range.

Exceptions

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

Applies to

TextRange(ITextDocumentSnapshot, Int32, Int32)

Initializes a new instance of a TextRange with the specified document, start point, and length.

public TextRange (Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot document, int start, int length);
new Microsoft.VisualStudio.Extensibility.Editor.TextRange : Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot * int * int -> Microsoft.VisualStudio.Extensibility.Editor.TextRange
Public Sub New (document As ITextDocumentSnapshot, start As Integer, length As Integer)

Parameters

document
ITextDocumentSnapshot

The text document version on which to base the range.

start
Int32

The starting point of the range.

length
Int32

The length of the range.

Exceptions

document is null.

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

Applies to