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)

public interface ITextSnapshot

The ITextSnapshot type exposes the following members.

  NameDescription
Public propertyContentTypeGets the IContentType of the TextBuffer when this snapshot was current.
Public propertyItemGets one character at the specified position.
Public propertyLengthGets the number of UTF-16 characters in the snapshot.
Public propertyLineCountGets the number of lines in the snapshot.
Public propertyLinesGets an enumerator for the set of lines in the snapshot.
Public propertyTextBufferThe ITextBuffer of which this is a snapshot.
Public propertyVersionThe version of the ITextBuffer that this ITextSnapshot represents.
Top

  NameDescription
Public methodCopyToCopies a range of text to a character array.
Public methodCreateTrackingPoint(Int32, PointTrackingMode)Creates a ITrackingPoint in this snapshot.
Public methodCreateTrackingPoint(Int32, PointTrackingMode, TrackingFidelityMode)Creates a ITrackingPoint in this snapshot.
Public methodCreateTrackingSpan(Span, SpanTrackingMode)Creates a ITrackingSpan in this snapshot.
Public methodCreateTrackingSpan(Int32, Int32, SpanTrackingMode)Creates a ITrackingSpan in this snapshot.
Public methodCreateTrackingSpan(Span, SpanTrackingMode, TrackingFidelityMode)Creates a ITrackingSpan in this snapshot.
Public methodCreateTrackingSpan(Int32, Int32, SpanTrackingMode, TrackingFidelityMode)Creates a ITrackingSpan in this snapshot.
Public methodGetLineFromLineNumberGets an ITextSnapshotLine for the given line number.
Public methodGetLineFromPositionGets an ITextSnapshotLine for a line at the given position.
Public methodGetLineNumberFromPositionGets the number of the line that contains the character at the specified position.
Public methodGetText()Gets all the text in the snapshot.
Public methodGetText(Span)Gets text from the snapshot starting at the beginning of the span and having a length equal to the length of the span.
Public methodGetText(Int32, Int32)Gets text from the snapshot starting at startIndex and having a length equal to length.
Public methodToCharArrayConverts a range of text to a character array.
Public methodWrite(TextWriter)Writes the contents of the snapshot.
Public methodWrite(TextWriter, Span)Writes a substring of the contents of the snapshot.
Top

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft