ITextSnapshot Interface
Provides read access to an immutable snapshot of a ITextBuffer that contains a sequence of Unicode characters.
Namespace: Microsoft.VisualStudio.Text
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Syntax
'Declaration
Public Interface ITextSnapshot
public interface ITextSnapshot
public interface class ITextSnapshot
type ITextSnapshot = interface end
public interface ITextSnapshot
The ITextSnapshot type exposes the following members.
Properties
Name | Description | |
---|---|---|
ContentType | Gets the IContentType of the TextBuffer when this snapshot was current. | |
Item | Gets one character at the specified position. | |
Length | Gets the number of UTF-16 characters in the snapshot. | |
LineCount | Gets the number of lines in the snapshot. | |
Lines | Gets an enumerator for the set of lines in the snapshot. | |
TextBuffer | The ITextBuffer of which this is a snapshot. | |
Version | The version of the ITextBuffer that this ITextSnapshot represents. |
Top
Methods
Name | Description | |
---|---|---|
CopyTo | Copies a range of text to a character array. | |
CreateTrackingPoint(Int32, PointTrackingMode) | Creates a ITrackingPoint in this snapshot. | |
CreateTrackingPoint(Int32, PointTrackingMode, TrackingFidelityMode) | Creates a ITrackingPoint in this snapshot. | |
CreateTrackingSpan(Span, SpanTrackingMode) | Creates a ITrackingSpan in this snapshot. | |
CreateTrackingSpan(Int32, Int32, SpanTrackingMode) | Creates a ITrackingSpan in this snapshot. | |
CreateTrackingSpan(Span, SpanTrackingMode, TrackingFidelityMode) | Creates a ITrackingSpan in this snapshot. | |
CreateTrackingSpan(Int32, Int32, SpanTrackingMode, TrackingFidelityMode) | Creates a ITrackingSpan in this snapshot. | |
GetLineFromLineNumber | Gets an ITextSnapshotLine for the given line number. | |
GetLineFromPosition | Gets an ITextSnapshotLine for a line at the given position. | |
GetLineNumberFromPosition | Gets the number of the line that contains the character at the specified position. | |
GetText() | Gets all the text in the snapshot. | |
GetText(Span) | Gets text from the snapshot starting at the beginning of the span and having a length equal to the length of the span. | |
GetText(Int32, Int32) | Gets text from the snapshot starting at startIndex and having a length equal to length. | |
ToCharArray | Converts a range of text to a character array. | |
Write(TextWriter) | Writes the contents of the snapshot. | |
Write(TextWriter, Span) | Writes a substring of the contents of the snapshot. |
Top
Remarks
For more information about text snapshots, see "A Closer Look at the Text Model and the Text View" in Inside the Editor.
The first character in the sequence has index zero.