ITextSnapshot 接口

提供对包含 Unicode 字符序列 ITextBuffer 的不可变快照的读取权限。

命名空间:  Microsoft.VisualStudio.Text
程序集:  Microsoft.VisualStudio.Text.Data(在 Microsoft.VisualStudio.Text.Data.dll 中)

语法

声明
Public Interface ITextSnapshot
public interface ITextSnapshot
public interface class ITextSnapshot
type ITextSnapshot =  interface end
public interface ITextSnapshot

ITextSnapshot 类型公开以下成员。

属性

  名称 说明
公共属性 ContentType ,在此快照,获取当前 TextBufferIContentType
公共属性 Item 获取对指定位置的字符。
公共属性 Length 获取 UTF-16 快照中的字符数。
公共属性 LineCount 获取行的数量快照中的。
公共属性 Lines 获取集的枚举器快照中的行。
公共属性 TextBuffer 此快照所对应的 ITextBuffer
公共属性 Version 此 ITextSnapshot 表示的 ITextBuffer 的版本。

页首

方法

  名称 说明
公共方法 CopyTo 将文本范围复制到字符数组。
公共方法 CreateTrackingPoint(Int32, PointTrackingMode) 此快照创建 ITrackingPoint
公共方法 CreateTrackingPoint(Int32, PointTrackingMode, TrackingFidelityMode) 此快照创建 ITrackingPoint
公共方法 CreateTrackingSpan(Span, SpanTrackingMode) 此快照创建 ITrackingSpan
公共方法 CreateTrackingSpan(Int32, Int32, SpanTrackingMode) 此快照创建 ITrackingSpan
公共方法 CreateTrackingSpan(Span, SpanTrackingMode, TrackingFidelityMode) 此快照创建 ITrackingSpan
公共方法 CreateTrackingSpan(Int32, Int32, SpanTrackingMode, TrackingFidelityMode) 此快照创建 ITrackingSpan
公共方法 GetLineFromLineNumber 获取给定行号所对应的 ITextSnapshotLine
公共方法 GetLineFromPosition 获取给定位置的行的 ITextSnapshotLine
公共方法 GetLineNumberFromPosition 获取包含指定位置的字符的行号。
公共方法 GetText() 获取快照中的所有文本。
公共方法 GetText(Span) 从一个快照获取文本开始在范围的开头和长度等于该范围的长度。
公共方法 GetText(Int32, Int32) 从一个快照获取文本开始在 startIndex 和长度等于 length。
公共方法 ToCharArray 将文本范围转换为字符数组。
公共方法 Write(TextWriter) 写入快照的内容。
公共方法 Write(TextWriter, Span) 写入快照内容的子字符串。

页首

备注

有关文本快照的更多信息,请参见中的 “文本模型和文本视图的仔细的行为”。 在编辑器内

该序列中的第一个字符的索引零。

请参阅

参考

Microsoft.VisualStudio.Text 命名空间