TextFileContent Class

Holds the text of a file, and the encoding to write the file back with.

public sealed class TextFileContent

Constructors

NameDescription
TextFileContent(string, Encoding)Initializes a new instance of the TextFileContent class.

TextFileContent(string, Encoding)

Initializes a new instance of the TextFileContent class.

public TextFileContent(string text, Encoding encoding)

Parameters

text string
The text of the file.
encoding Encoding
The encoding to write the file back with.

Exceptions

ArgumentNullException
text is null. - or - encoding is null.

Properties

NameDescription
EncodingGets the encoding to write the file back with.
TextGets the text of the file.

Encoding

Gets the encoding to write the file back with.

public Encoding Encoding { get; }

Property value

Encoding For a content that TextFileUtility.ReadAllText returns, the encoding of the byte order mark of the file, or the fallback encoding if the file has none.

Text

Gets the text of the file.

public string Text { get; }

Property value

string

Methods

NameDescription
Deconstruct(string, Encoding)Deconstructs this instance into the text of the file and the encoding to write the file back with.

Deconstruct(string, Encoding)

Deconstructs this instance into the text of the file and the encoding to write the file back with.

public void Deconstruct(out string text, out Encoding encoding)

Parameters

text string
When this method returns, the value of TextFileContent.Text.
encoding Encoding
When this method returns, the value of TextFileContent.Encoding.