Version

TextDocumentSnapshotScanner Class

Exposes methods for scanning through a snapshot of a TextDocument
Syntax
'Declaration
 
Public Class TextDocumentSnapshotScanner 
public class TextDocumentSnapshotScanner 
Remarks

This class targets a specific instance of a snapshot and is created via the snapshot’s CreateScanner method. It is used for efficiently scanning thru the snapshot’s lines, tokens and words.

The CurrentOffset property is used to scan thru the snapshot. It can either be set explicitly (it defaults to zero) or via the SeekToStart, SeekToEnd, SeekToLine(LineScanType), SeekToToken or SeekToWord methods. Once set, the CurrentLine, CurrentToken, CurrentWord and CurrentCharacter read-only properties can be used to query what is at the CurrentOffset. In addition, there are 'Peek' next/previous token and word methods to look ahead or behind without changing the CurrentOffset.

Note: even though the snapshot that it targets is thread-safe, the scanner is not. Therefore it should be created on the same thread that it is used on (i.e. each thread accessing a scanner should create its own). Trying to access the properties and methods of a scanner created on another thread will raise an InvalidOperationException.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also