Delen via


SourceText Class

Definition

An abstraction of source text.

public ref class SourceText abstract
public abstract class SourceText
type SourceText = class
Public MustInherit Class SourceText
Inheritance
SourceText

Constructors

SourceText(ImmutableArray<Byte>, SourceHashAlgorithm, SourceTextContainer)

Properties

CanBeEmbedded

Indicates whether this source text can be embedded in the PDB.

ChecksumAlgorithm

Hash algorithm to use to calculate checksum of the text that's saved to PDB.

Container

The container of this SourceText.

Encoding

Encoding of the file that the text was read from or is going to be saved to. null if the encoding is unspecified.

Item[Int32]

Returns a character at given position.

Length

The length of the text in characters.

Lines

The collection of individual text lines.

Methods

ContentEquals(SourceText)

Compares the content with content of another SourceText.

ContentEqualsImpl(SourceText)

Implements equality comparison of the content of two different instances of SourceText.

CopyTo(Int32, Char[], Int32, Int32)

Copy a range of characters from this SourceText to a destination array.

From(Byte[], Int32, Encoding, SourceHashAlgorithm, Boolean, Boolean)

Constructs a SourceText from a byte array.

From(Byte[], Int32, Encoding, SourceHashAlgorithm, Boolean)
From(Stream, Encoding, SourceHashAlgorithm, Boolean, Boolean)

Constructs a SourceText from stream content.

From(Stream, Encoding, SourceHashAlgorithm, Boolean)
From(String, Encoding, SourceHashAlgorithm)

Constructs a SourceText from text in a string.

From(TextReader, Int32, Encoding, SourceHashAlgorithm)

Constructs a SourceText from text in a string.

GetChangeRanges(SourceText)

Gets the set of TextChangeRange that describe how the text changed between this text an older version. This may be multiple detailed changes or a single change encompassing the entire text.

GetChecksum()

Cryptographic checksum determined by ChecksumAlgorithm. Computed using the original bytes that were used to produce this SourceText (if any of the From methods were used that take a byte[] or Stream). Otherwise, computed by writing this SourceText back to a Stream (using the provided Encoding), and computing the hash off of that.

GetContentHash()

Produces a hash of this SourceText based solely on the contents it contains. Two different SourceText instances that are ContentEquals(SourceText) will have the same content hash. Two instances of SourceText with different content are virtually certain to not have the same hash. This hash can be used for fingerprinting of text instances, but does not provide cryptographic guarantees.

GetLinesCore()

Called from Lines to initialize the TextLineCollection. Thereafter, the collection is cached.

GetSubText(Int32)

Returns a SourceText that has the contents of this text including and after the start position.

GetSubText(TextSpan)

Gets a SourceText that contains the characters in the specified span of this text.

GetTextChanges(SourceText)

Gets the set of TextChange that describe how the text changed between this text and an older version. This may be multiple detailed changes or a single change encompassing the entire text.

Replace(Int32, Int32, String)

Returns a new SourceText with the specified range of characters replaced by the new text.

Replace(TextSpan, String)

Returns a new SourceText with the specified span of characters replaced by the new text.

ToString()

Provides a string representation of the SourceText.

ToString(TextSpan)

Gets a string containing the characters in specified span.

WithChanges(IEnumerable<TextChange>)

Constructs a new SourceText from this text with the specified changes.

WithChanges(TextChange[])

Constructs a new SourceText from this text with the specified changes.

Write(TextWriter, CancellationToken)

Write this SourceText to a text writer.

Write(TextWriter, TextSpan, CancellationToken)

Write a span of text to a text writer.

Applies to