Click or drag to resize

SourceText Class



An abstraction of source text.
Inheritance Hierarchy
SystemObject
  Microsoft.CodeAnalysis.TextSourceText

Namespace:  Microsoft.CodeAnalysis.Text
Assembly:  Microsoft.CodeAnalysis (in Microsoft.CodeAnalysis.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public abstract class SourceText

The SourceText type exposes the following members.

Constructors
  NameDescription
Protected methodSourceText
Initializes a new instance of the SourceText class
Top
Properties
  NameDescription
Public propertyCanBeEmbedded
Indicates whether this source text can be embedded in the PDB.
Public propertyChecksumAlgorithm
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
Public propertyContainer
The container of this SourceText.
Public propertyEncoding
Encoding of the file that the text was read from or is going to be saved to. null if the encoding is unspecified.
Public propertyItem
Returns a character at given position.
Public propertyLength
The length of the text in characters.
Public propertyLines
The collection of individual text lines.
Top
Methods
  NameDescription
Public methodContentEquals
Compares the content with content of another SourceText.
Protected methodContentEqualsImpl
Implements equality comparison of the content of two different instances of SourceText.
Public methodCopyTo
Copy a range of characters from this SourceText to a destination array.
Public methodStatic memberFrom(String, Encoding, SourceHashAlgorithm)
Constructs a SourceText from text in a string.
Public methodStatic memberFrom(Stream, Encoding, SourceHashAlgorithm, Boolean)
Public methodStatic memberFrom(TextReader, Int32, Encoding, SourceHashAlgorithm)
Constructs a SourceText from text in a string.
Public methodStatic memberFrom(Byte, Int32, Encoding, SourceHashAlgorithm, Boolean)
Public methodStatic memberFrom(Stream, Encoding, SourceHashAlgorithm, Boolean, Boolean)
Constructs a SourceText from stream content.
Public methodStatic memberFrom(Byte, Int32, Encoding, SourceHashAlgorithm, Boolean, Boolean)
Constructs a SourceText from a byte array.
Public methodGetChangeRanges
Public methodGetChecksum
Protected methodGetLinesCore
Called from Lines to initialize the TextLineCollection. Thereafter, the collection is cached.
Public methodGetSubText(Int32)
Returns a SourceText that has the contents of this text including and after the start position.
Public methodGetSubText(TextSpan)
Gets a SourceText that contains the characters in the specified span of this text.
Public methodGetTextChanges
Public methodReplace(TextSpan, String)
Returns a new SourceText with the specified span of characters replaced by the new text.
Public methodReplace(Int32, Int32, String)
Returns a new SourceText with the specified range of characters replaced by the new text.
Public methodToString
Provides a string representation of the SourceText.
Public methodToString(TextSpan)
Gets a string containing the characters in specified span.
Public methodWithChanges(IEnumerableT)
Public methodWithChanges(TextChange)
Constructs a new SourceText from this text with the specified changes.
Public methodWrite(TextWriter, CancellationToken)
Write this SourceText to a text writer.
Public methodWrite(TextWriter, TextSpan, CancellationToken)
Write a span of text to a text writer.
Top
Extension Methods
  NameDescription
Public Extension MethodFindCorrespondingEditorTextSnapshot
Returns the ITextSnapshot behind this SourceText, or null if it wasn't created from one. Note that multiple ITextSnapshots may map to the same SourceText instance if ITextSnapshot.Version.ReiteratedVersionNumber doesn't change.
(Defined by Extensions.)
Top
See Also